/* Shared Header */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(18px);
}

#header:empty {
  min-height: 70px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(18px);
}

.header-container {
  max-width: 100%;
  margin: 0;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.logo {
  font-size: 25px;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(135deg, #2563eb, #16a34a);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.1);
}

.logo:hover {
  color: #2563eb;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  z-index: 101;
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: #0f172a;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar {
  display: none;
  position: fixed;
  top: 70px;
  left: -280px;
  width: 280px;
  height: calc(100vh - 70px);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 18px 0 40px rgba(15, 23, 42, 0.12);
  z-index: 99;
  transition: left 0.3s ease;
  overflow-y: auto;
  flex-direction: column;
  padding: 20px 0;
  border-right: 1px solid #e2e8f0;
}

.sidebar.active {
  left: 0;
}

.sidebar-link {
  color: #334155;
  text-decoration: none;
  font-weight: 500;
  padding: 14px 24px;
  border-left: 4px solid transparent;
  transition: all 0.3s ease;
}

.sidebar-link:hover {
  background: #f8fafc;
  border-left-color: #2563eb;
  color: #0f172a;
}

.nav-link {
  color: #475569;
  text-decoration: none;
  font-weight: 650;
  position: relative;
  padding: 9px 12px;
  border-radius: 10px;
  transition: all 0.3s ease;
  font-size: 14px;
}

.nav-link::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: #2563eb;
  transition: width 0.3s ease;
}

.nav-link:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.nav-link:hover::before {
  width: 80%;
}

/* ======= DROPDOWN MENUS ======= */
.nav-dropdown {
  position: relative;
}

/* Invisible bridge to prevent hover gap */
.nav-dropdown::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.dropdown-arrow {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 0;
  min-width: 180px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  transform: translateX(-50%) translateY(6px);
  z-index: 200;
}

.nav-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dropdown-item {
  display: block;
  padding: 10px 20px;
  color: #475569;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: #f8fafc;
  color: #0f172a;
  padding-left: 24px;
}

/* Sidebar group labels for mobile */
.sidebar-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 24px 6px;
  margin-top: 4px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.user-email {
  font-size: 14px;
  color: #0f172a;
  font-weight: 600;
}

.user-role {
  font-size: 12px;
  color: white;
  padding: 3px 10px;
  background: linear-gradient(135deg, #2563eb 0%, #0f172a 100%);
  border-radius: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.btn-logout {
  padding: 10px 20px;
  background: #0f172a;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: #1e293b;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.22);
  transform: translateY(-2px);
}

/* Desktop layout */
@media (min-width: 769px) {
  .hamburger {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .nav {
    display: flex;
  }
}

/* Tablet layout */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    display: flex;
  }

  .nav {
    display: none;
  }

  .header-container {
    gap: 12px;
    padding: 14px 20px;
  }

  .user-info {
    align-items: center;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .header-container {
    padding: 12px 16px;
  }

  .logo {
    font-size: 20px;
  }

  .user-email {
    font-size: 12px;
  }

  .sidebar {
    width: 250px;
    left: -250px;
  }
}

/* Small mobile phones */
@media (max-width: 360px) {
  .header-container {
    padding: 10px 12px;
  }

  .logo {
    font-size: 18px;
  }

  .user-info {
    padding: 6px 8px;
  }

  .sidebar {
    width: 220px;
    left: -220px;
    padding: 16px 0;
  }

  .sidebar-link {
    padding: 12px 16px;
  }
}
