/* Modern Card-Style Dropdown for Projects */
.projects-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  padding: 24px;
  margin-top: 12px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999;
  min-width: 600px;
  max-width: 650px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

.nav-item.dropdown:hover .projects-dropdown,
.nav-item.dropdown.active .projects-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Mobile Back Arrow */
.mobile-back-arrow {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 1000;
  width: 45px;
  height: 45px;
  background: rgba(40, 167, 69, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.mobile-back-arrow:hover {
  background: rgba(33, 136, 56, 1);
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.mobile-back-arrow i {
  color: white;
  font-size: 22px;
}

/* For hero sections - keep at top */
#home .mobile-back-arrow {
  top: 20px;
}

@media (max-width: 768px) {
  .mobile-back-arrow {
    display: flex !important;
  }
}

.nav-item.dropdown {
  position: relative;
}

@media (min-width: 992px) {
  .projects-dropdown {
    left: auto;
    right: -100px;
    transform: none;
  }
}

/* Desktop: Hover to show dropdown */
@media (min-width: 769px) {
  .nav-item.dropdown:hover .projects-dropdown {
    opacity: 1;
    visibility: visible;
    margin-top: 8px;
  }
}

/* Mobile: Click to toggle dropdown */
@media (max-width: 768px) {
  .projects-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    min-width: auto;
    padding: 16px;
    margin: 0;
    border-radius: 8px;
    max-height: 70vh;
    overflow-y: auto;
    transition: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  }

  .nav-item.dropdown.active .projects-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    margin-top: 0;
    display: block !important;
  }

  .nav-item.dropdown:not(.active) .projects-dropdown {
    opacity: 0 !important;
    visibility: hidden !important;
    display: none !important;
  }
}

.projects-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  transition: all 0.3s ease;
  text-decoration: none;
  background: #f8f9fa;
  border: 1px solid transparent;
}

.project-card:hover {
  background: #fff;
  border-color: #28a745;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
  transform: translateY(-2px);
}

.project-card-image {
  width: 120px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.project-card-content {
  flex: 1;
  min-width: 0;
}

.project-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f4229;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.project-card-description {
  font-size: 13px;
  color: #666;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #28a745;
  color: white;
  font-weight: 600;
  margin-top: 4px;
}

.nav-item.dropdown .dropdown-menu {
  display: none !important;
}

@media (max-width: 768px) {
  .projects-dropdown {
    min-width: 90vw;
    left: 5vw;
    transform: none;
    padding: 16px;
  }

  .projects-dropdown-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Smaller cards for mobile */
  .project-card {
    padding: 8px;
    gap: 8px;
  }

  .project-card-image {
    width: 70px;
    height: 55px;
  }

  .project-card-title {
    font-size: 13px;
    margin-bottom: 2px;
  }

  .project-card-description {
    font-size: 11px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
  }

  .project-card-badge {
    font-size: 8px;
    padding: 2px 6px;
    margin-top: 3px;
  }
}
