/* ========================================
   MODERN PREMIUM HEADER STYLING
   ======================================== */

:root {
  --header-bg: rgba(255, 255, 255, 0.92);
  --header-border: rgba(148, 163, 184, 0.16);
  --header-shadow: 0 24px 64px rgba(15, 23, 42, 0.08);
  --nav-active: #2563eb;
  --nav-hover: #3b82f6;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-light: rgba(148, 163, 184, 0.23);
  --btn-primary: #2563eb;
  --btn-secondary: rgba(37, 99, 235, 0.07);
  --transition-smooth: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --header-bg: rgba(15, 23, 42, 0.92);
  --header-border: rgba(71, 85, 105, 0.22);
  --header-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  --nav-active: #60a5fa;
  --nav-hover: #93c5fd;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-light: rgba(100, 116, 139, 0.24);
  --btn-primary: #3b82f6;
  --btn-secondary: rgba(96, 165, 250, 0.14);
}

/* ========================================
   MAIN HEADER CONTAINER
   ======================================== */

.main-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
  backdrop-filter: saturate(180%) blur(18px);
  transition: var(--transition-smooth);
}

.main-header.shrink {
  border-bottom-color: rgba(148, 163, 184, 0.12);
}

.main-header.shrink .header-container {
  min-height: 68px;
}

.main-header.shrink .logo-container {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.main-header.shrink .logo-img {
  height: 34px;
}

.header-top-section {
  width: 100%;
}

.header-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 2rem;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  transition: min-height 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.28s ease, padding 0.28s ease;
}

/* ========================================
   BRANDING SECTION
   ======================================== */

.header-branding {
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.logo-link:hover .logo-container {
  transform: translateY(-2px) scale(1.02);
}

.logo-container {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
  transition: var(--transition-smooth);
}

.logo-img {
  width: auto;
  height: 44px;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.2));
}

.branding-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-weight: 700;
}

.main-title {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
  margin: 0;
}

.subtitle {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nav-active);
  margin: 0;
}

/* ========================================
   MAIN NAVIGATION BAR
   ======================================== */

.main-nav-bar {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-menu {
  display: flex;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 0.9rem 1.15rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.nav-item i {
  font-size: 1rem;
}

.nav-item:hover,
.nav-item:focus-visible {
  color: var(--nav-hover);
  background: rgba(37, 99, 235, 0.08);
  outline: none;
  transform: translateY(-1px);
}

.nav-item.active {
  color: var(--nav-active);
  background: rgba(37, 99, 235, 0.14);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 1rem;
  right: 1rem;
  height: 3px;
  background: var(--nav-active);
  border-radius: 999px;
}

/* ========================================
   CTA BUTTONS + UTILITY ACTIONS
   ======================================== */

.header-right-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.cta-group {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.85rem 1.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--btn-primary) 0%, #3b82f6 100%);
  color: #ffffff;
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(37, 99, 235, 0.24);
  outline: none;
}

.btn-secondary {
  background: var(--btn-secondary);
  color: var(--text-primary);
  border-color: rgba(37, 99, 235, 0.22);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: rgba(37, 99, 235, 0.14);
  color: var(--nav-active);
  outline: none;
}

.btn-tertiary {
  background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
  color: var(--text-primary);
  border-color: rgba(37, 99, 235, 0.18);
}

.btn-tertiary:hover,
.btn-tertiary:focus-visible {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  outline: none;
}

.btn-dropdown {
  background: rgba(37, 99, 235, 0.08);
  color: var(--text-primary);
  border-color: rgba(37, 99, 235, 0.2);
}

.btn-dropdown:hover,
.btn-dropdown:focus-visible {
  background: rgba(37, 99, 235, 0.14);
  color: var(--nav-active);
  outline: none;
}

.btn-theme-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  display: grid;
  place-items: center;
}

.btn-theme-toggle:hover,
.btn-theme-toggle:focus-visible {
  background: rgba(37, 99, 235, 0.12);
  border-color: var(--nav-active);
  color: var(--nav-active);
  outline: none;
  transform: scale(1.04);
}

/* ========================================
   DROPDOWN PANEL
   ======================================== */

.dropdown-wrap {
  position: relative;
}

.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.75rem);
  width: min(320px, calc(100vw - 2rem));
  background: var(--header-bg);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
  padding: 0.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
  z-index: 20;
}

.dropdown-panel.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-link {
  display: block;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.dropdown-link + .dropdown-link {
  margin-top: 0.4rem;
}

.dropdown-link:hover,
.dropdown-link:focus-visible {
  background: rgba(37, 99, 235, 0.09);
  color: var(--nav-active);
  outline: none;
}

/* ========================================
   MOBILE DRAWER
   ======================================== */

.mobile-drawer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1150;
  transition: transform 0.32s ease;
  transform: translateX(100%);
}

.mobile-drawer.open {
  pointer-events: auto;
  transform: translateX(0);
}

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
}

.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--header-bg);
  border-left: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: -24px 0 64px rgba(15, 23, 42, 0.18);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.drawer-branding {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.drawer-logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  display: grid;
  place-items: center;
}

.drawer-logo img {
  width: 28px;
  height: auto;
}

.drawer-eyebrow,
.drawer-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.drawer-subtitle {
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-close {
  border: none;
  background: rgba(148, 163, 184, 0.14);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.drawer-close:hover {
  background: rgba(37, 99, 235, 0.12);
}

.mobile-nav-menu,
.drawer-role-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.mobile-nav-link,
.drawer-role-link {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text-primary);
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.06);
  font-weight: 600;
  transition: var(--transition-smooth);
}

.mobile-nav-link:hover,
.drawer-role-link:hover,
.mobile-nav-link:focus-visible,
.drawer-role-link:focus-visible {
  background: rgba(37, 99, 235, 0.12);
  color: var(--nav-active);
  outline: none;
}

.mobile-nav-link i {
  width: 1.2rem;
  text-align: center;
}

.drawer-actions {
  display: grid;
  gap: 0.85rem;
  margin-top: auto;
}

/* ========================================
   ANNOUNCEMENT BANNER
   ======================================== */

.header-announcement {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  padding: 0.9rem 2rem;
}

.announcement-content {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 600;
}

.announcement-content i {
  color: #2563eb;
  animation: bounce 2s infinite;
}

.announcement-close {
  background: none;
  border: none;
  font-size: 1.35rem;
  color: #0f172a;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  transition: var(--transition-smooth);
}

.announcement-close:hover {
  transform: rotate(90deg);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* ========================================
   MOBILE TOGGLE BUTTON & LINES
   ======================================== */

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1105;
  outline: none;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 3px;
  background-color: var(--text-primary);
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.menu-toggle:hover .hamburger-line {
  background-color: var(--nav-hover);
}

/* ========================================
   ACCESSIBILITY
   ======================================= */

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1440px) {
  .main-header .cta-group .btn-tertiary {
    display: none !important;
  }
}

@media (max-width: 1300px) {
  .main-header .cta-group .btn-secondary {
    display: none !important;
  }
  .main-header .nav-item {
    padding: 0.7rem 0.9rem !important;
    font-size: 0.9rem !important;
  }
  .main-header .header-container {
    gap: 1.5rem !important;
  }
}

@media (max-width: 1100px) {
  .header-container {
    padding: 0 1.5rem;
    gap: 1.2rem;
    min-height: 76px;
  }

  .main-nav-bar,
  .cta-group {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 1rem;
    min-height: 68px;
  }

  .logo-container {
    width: 52px;
    height: 52px;
  }

  .logo-img {
    height: 38px;
  }

  .main-title {
    font-size: 1.35rem;
  }

  .subtitle,
  .eyebrow {
    display: none;
  }

  .drawer-panel {
    width: 100%;
  }

  .header-announcement {
    padding: 0.9rem 1rem;
  }

  .announcement-content {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .header-container {
    gap: 0.75rem;
  }

  .menu-toggle {
    width: 24px;
    height: 16px;
  }

  .hamburger-line {
    width: 20px;
    height: 2.5px;
  }

  .drawer-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .drawer-close {
    align-self: flex-end;
  }
}
