/* ==========================================================================
   WEES Alumni Welfare Trust - Navigation & Top Utility Bar Styling
   Accessible marquee ticker, glassmorphism navbar, mobile drawer, and zero CLS
   ========================================================================== */

:root {
  --topbar-bg: #0b1324;
  --topbar-text: #cbd5e1;
  --topbar-link-hover: #ffffff;
  --topbar-height: 38px;
  --nav-height-desktop: 74px;
  --nav-glass-bg: rgba(255, 255, 255, 0.92);
  --nav-glass-border: rgba(0, 0, 0, 0.06);
  --nav-dropdown-bg: #ffffff;
  --nav-dropdown-shadow: 0 16px 36px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
}

[data-bs-theme="dark"] {
  --topbar-bg: #030712;
  --topbar-text: #94a3b8;
  --topbar-link-hover: #38bdf8;
  --nav-glass-bg: rgba(15, 23, 42, 0.92);
  --nav-glass-border: rgba(255, 255, 255, 0.08);
  --nav-dropdown-bg: #1e293b;
  --nav-dropdown-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* -------------------------------------------------------------
   1. Accessible Top Utility Marquee Bar
   ------------------------------------------------------------- */
.wees-topbar {
  background-color: var(--topbar-bg);
  color: var(--topbar-text);
  font-size: 0.8125rem;
  line-height: 1.4;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--topbar-height);
  position: relative;
  z-index: 1040;
}

/* Social Icon Cluster */
.topbar-social-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-social-link {
  color: var(--topbar-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}

.topbar-social-link:hover,
.topbar-social-link:focus-visible {
  color: var(--topbar-link-hover);
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
  outline: 2px solid #38bdf8;
  outline-offset: 1px;
}

/* Pure CSS Keyframe Marquee Notice Ticker (No deprecated <marquee>) */
.marquee-wrapper {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
  width: 100%;
}

.marquee-content {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: marqueeTicker 28s linear infinite;
  will-change: transform;
}

.marquee-wrapper:hover .marquee-content,
.marquee-wrapper:focus-within .marquee-content {
  animation-play-state: paused;
}

.marquee-tag {
  background: #f59e0b;
  color: #1e1b4b;
  font-weight: 700;
  font-size: 0.6875rem;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
  display: inline-block;
}

.marquee-text {
  font-weight: 500;
  color: #f1f5f9;
}

@keyframes marqueeTicker {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* Accessibility: Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .marquee-content {
    animation: none;
    padding-left: 0;
    white-space: normal;
  }
  .marquee-wrapper {
    mask-image: none;
    -webkit-mask-image: none;
  }
}

/* -------------------------------------------------------------
   2. Main Navigation Bar with Glassmorphism
   ------------------------------------------------------------- */
.navbar-wees-main {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: var(--nav-glass-bg);
  border-bottom: 1px solid var(--nav-glass-border);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  min-height: var(--nav-height-desktop);
  z-index: 1030;
}

/* Zero Cumulative Layout Shift (CLS) reservation */
.header-wrapper {
  min-height: calc(var(--topbar-height) + var(--nav-height-desktop));
}

/* Logo Image Fix for LCP & CLS */
.navbar-wees-main .brand-logo-img {
  width: 120px;
  height: 42px;
  aspect-ratio: 120 / 42;
  object-fit: contain;
}

/* Navigation Links */
.navbar-wees-main .nav-link {
  color: var(--bs-body-color);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1rem !important;
  border-radius: 9999px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.navbar-wees-main .nav-link:hover,
.navbar-wees-main .nav-link:focus-visible {
  color: var(--wees-primary, #0d6efd) !important;
  background-color: rgba(13, 110, 253, 0.08);
}

.navbar-wees-main .nav-link.active {
  color: var(--wees-primary, #0d6efd) !important;
  background-color: rgba(13, 110, 253, 0.1);
  font-weight: 700;
}

/* Dropdown Menu Aesthetics */
.navbar-wees-main .dropdown-menu {
  background-color: var(--nav-dropdown-bg);
  border: 1px solid var(--nav-glass-border);
  border-radius: 14px;
  box-shadow: var(--nav-dropdown-shadow);
  padding: 0.5rem;
  min-width: 250px;
  margin-top: 0.5rem;
  animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.navbar-wees-main .dropdown-item {
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  color: var(--bs-body-color);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: all 0.15s ease;
}

.navbar-wees-main .dropdown-item:hover,
.navbar-wees-main .dropdown-item:focus {
  background-color: rgba(13, 110, 253, 0.08);
  color: var(--wees-primary, #0d6efd);
  transform: translateX(3px);
}

.navbar-wees-main .dropdown-item.active {
  background-color: rgba(13, 110, 253, 0.12);
  color: var(--wees-primary, #0d6efd);
  font-weight: 700;
}

/* Desktop Hover Support for Dropdown */
@media (min-width: 992px) {
  .navbar-wees-main .dropdown:hover > .dropdown-menu {
    display: block;
    margin-top: 0;
  }
  .navbar-wees-main .dropdown > .dropdown-toggle:active {
    pointer-events: none;
  }
}

/* -------------------------------------------------------------
   3. Auth & CTA Action Cluster
   ------------------------------------------------------------- */
.nav-cta-btn {
  padding: 0.55rem 1.35rem;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 9999px;
  transition: all 0.25s ease;
  letter-spacing: 0.2px;
}

.nav-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 110, 253, 0.28);
}

.nav-signin-link {
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.55rem 1rem;
  border-radius: 9999px;
  color: var(--bs-body-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-signin-link:hover {
  color: var(--wees-primary, #0d6efd);
  background-color: rgba(13, 110, 253, 0.08);
}

/* Avatar Pill */
.nav-avatar-pill {
  border: 1px solid var(--nav-glass-border);
  background: var(--nav-glass-bg);
  padding: 4px 14px 4px 6px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--bs-body-color);
  transition: all 0.2s ease;
}

.nav-avatar-pill:hover,
.nav-avatar-pill:focus-visible {
  border-color: var(--wees-primary, #0d6efd);
  box-shadow: 0 2px 10px rgba(13, 110, 253, 0.15);
}

.nav-avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--wees-primary, #0d6efd);
}

/* -------------------------------------------------------------
   4. Mobile Offcanvas / Drawer Navigation (>= 44px Touch Targets)
   ------------------------------------------------------------- */
@media (max-width: 991.98px) {
  /* Brand logo auto-scale on compact screens */
  .navbar-wees-main .brand-logo-img {
    max-width: 95px;
    height: auto;
  }

  .brand-title-text {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .brand-title-text .brand-badge {
    font-size: 0.6rem;
    padding: 2px 5px;
  }

  /* Hamburger toggler accessibility and touch area */
  .navbar-wees-main .navbar-toggler {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, 0.08);
    transition: background-color 0.2s ease, transform 0.15s ease;
    cursor: pointer;
  }

  .navbar-wees-main .navbar-toggler:hover,
  .navbar-wees-main .navbar-toggler:focus {
    background: rgba(13, 110, 253, 0.16);
    outline: none;
  }

  .navbar-wees-main .navbar-toggler:active {
    transform: scale(0.95);
  }

  /* Robust Offcanvas drawer styling on mobile viewport */
  #navbarOffcanvas.offcanvas-lg {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1060;
    background-color: var(--nav-dropdown-bg, #ffffff);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.2);
    border-left: 1px solid var(--nav-glass-border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    visibility: hidden;
  }

  #navbarOffcanvas.offcanvas-lg.showing,
  #navbarOffcanvas.offcanvas-lg.show:not(.hiding) {
    transform: none;
    visibility: visible;
  }

  #navbarOffcanvas.offcanvas-lg.hiding {
    transform: translateX(100%);
    visibility: visible;
  }

  [data-bs-theme="dark"] #navbarOffcanvas.offcanvas-lg {
    background-color: #0f172a;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.6);
  }

  .navbar-wees-main .offcanvas-header {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--nav-glass-border);
    background: rgba(13, 110, 253, 0.04);
  }

  .navbar-wees-main .offcanvas-body {
    flex: 1 1 auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Nav Links in Drawer */
  .navbar-wees-main .nav-link {
    min-height: 48px; /* Accessible 44px+ touch target */
    display: flex;
    align-items: center;
    font-size: 1.02rem;
    padding: 0.75rem 1rem !important;
    border-radius: 12px;
    margin-bottom: 0.25rem;
  }

  /* Mobile Dropdown Menu Expander inside Offcanvas */
  .navbar-wees-main .dropdown-menu {
    position: static !important;
    transform: none !important;
    float: none;
    width: 100%;
    border: none;
    box-shadow: none;
    background: rgba(13, 110, 253, 0.04);
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
    margin-top: 0.25rem;
    border-radius: 10px;
  }

  [data-bs-theme="dark"] .navbar-wees-main .dropdown-menu {
    background: rgba(255, 255, 255, 0.04);
  }

  .navbar-wees-main .dropdown-item {
    min-height: 44px;
    border-radius: 8px;
    font-size: 0.95rem;
    padding: 0.55rem 0.85rem;
  }

  /* Mobile CTA and Auth Cluster */
  .mobile-cta-cluster {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--nav-glass-border);
    flex-shrink: 0;
  }

  .mobile-cta-cluster .theme-switch-btn {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(13, 110, 253, 0.05);
    border: 1px solid var(--nav-glass-border);
    font-weight: 600;
    font-size: 0.92rem;
  }

  .mobile-cta-cluster .theme-switch-btn::after {
    content: " Toggle Theme";
    font-size: 0.9rem;
    color: var(--bs-body-color);
  }

  .mobile-cta-cluster .nav-signin-link,
  .mobile-cta-cluster .nav-cta-btn,
  .mobile-cta-cluster .btn {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    border-radius: 12px;
  }

  .mobile-cta-cluster .nav-avatar-pill {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 14px;
    border-radius: 12px;
  }

  /* Top Utility Bar responsive adjustments */
  .wees-topbar .container {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }

  .topbar-social-links {
    gap: 0.5rem;
  }

  .topbar-social-link {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .navbar-wees-main .brand-logo-img {
    max-width: 75px;
    height: auto;
  }

  .brand-title-text {
    font-size: 0.85rem;
  }

  .brand-title-text .brand-badge {
    font-size: 0.58rem;
    padding: 1px 4px;
  }

  .wees-topbar .container {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.25rem;
  }

  .topbar-social-links {
    justify-content: center;
    width: 100%;
  }

  .marquee-wrapper {
    width: 100%;
    font-size: 0.75rem;
  }
}

/* Offcanvas backdrop z-index coordination */
.offcanvas-backdrop {
  z-index: 1055 !important;
}

/* -------------------------------------------------------------
   5. Universal Responsive Breadcrumbs
   ------------------------------------------------------------- */
.breadcrumb {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 2px;
}

.breadcrumb::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  flex-shrink: 0;
}

@media (max-width: 575.98px) {
  .breadcrumb {
    font-size: 0.78rem;
    gap: 2px;
  }
  
  .breadcrumb-item {
    font-size: 0.78rem;
  }
}
