/* =========================================================================
   TrimFile Mobile Navigation Styles (mobile-nav.css)
   Clean, modern, accessible hamburger menu for mobile devices (< 769px)
   ========================================================================= */

/* Global Silky Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Desktop & Tablet Defaults (>= 769px) - Keep full horizontal tabs */
.nav-hamburger {
  display: none !important;
}

.mobile-nav-drawer,
.mobile-nav-backdrop {
  display: none !important;
}

/* Mobile Screens (<= 768px) */
@media (max-width: 768px) {
  /* Keep header as a sleek single-row bar */
  .app-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 14px !important;
    border-radius: 28px !important;
    position: sticky !important;
    top: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Hide desktop horizontal tabs on mobile */
  .app-header .nav-tabs {
    display: none !important;
  }

  /* Modern Animated Hamburger Toggle Button */
  .nav-hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: rgba(225, 29, 72, 0.12);
    border: 1px solid rgba(225, 29, 72, 0.35);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
  }

  .nav-hamburger:hover,
  .nav-hamburger:focus-visible {
    background: rgba(225, 29, 72, 0.22);
    border-color: rgba(225, 29, 72, 0.6);
    outline: none;
  }

  .nav-hamburger .hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: #fecdd3;
    border-radius: 2px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, background 0.2s ease;
    transform-origin: center;
  }

  /* Hamburger to 'X' animation */
  .nav-hamburger.is-active {
    background: rgba(225, 29, 72, 0.25);
    border-color: rgba(225, 29, 72, 0.7);
    box-shadow: 0 0 14px rgba(225, 29, 72, 0.35);
  }

  .nav-hamburger.is-active .hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: #ffffff;
  }

  .nav-hamburger.is-active .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .nav-hamburger.is-active .hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: #ffffff;
  }

  /* Mobile Navigation Drawer / Dropdown Panel */
  .mobile-nav-drawer {
    display: block !important;
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(10, 11, 16, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(225, 29, 72, 0.35);
    border-radius: 18px;
    padding: 14px 12px 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.88), 0 0 30px rgba(159, 18, 57, 0.25);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px) scale(0.98);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.25s ease;
    box-sizing: border-box;
  }

  .mobile-nav-drawer.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }

  /* Section Title inside Mobile Drawer */
  .mobile-nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #fda4af;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 8px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mobile-nav-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(225, 29, 72, 0.25) 50%, transparent 100%);
    margin: 10px 0 8px;
  }

  /* Mobile Nav Links */
  .mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #e2e8f0;
    background: transparent;
    transition: all 0.2s ease;
    margin-bottom: 3px;
    border: 1px solid transparent;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link:active {
    background: rgba(225, 29, 72, 0.14);
    border-color: rgba(225, 29, 72, 0.3);
    color: #ffffff;
  }

  .mobile-nav-link.is-active {
    background: linear-gradient(135deg, rgba(159, 18, 57, 0.35) 0%, rgba(112, 13, 35, 0.45) 100%);
    border-color: rgba(225, 29, 72, 0.5);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  }

  .mobile-nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(225, 29, 72, 0.16);
    border: 1px solid rgba(225, 29, 72, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fb7185;
    flex-shrink: 0;
  }

  .mobile-nav-link.is-active .mobile-nav-icon {
    background: rgba(225, 29, 72, 0.3);
    color: #ffffff;
    border-color: rgba(225, 29, 72, 0.6);
  }

  .mobile-nav-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .mobile-nav-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
  }

  .mobile-nav-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.25;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-nav-arrow {
    font-size: 1rem;
    color: #fb7185;
    opacity: 0.7;
    margin-left: auto;
  }

  /* Backdrop Overlay */
  .mobile-nav-backdrop {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .mobile-nav-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }
}

/* =========================================================================
   Universal Desktop Extras Nav Dropdown (Zero-Gap Hover Bridge & Click Toggle)
   Guarantees the Extras dropdown never disappears unexpectedly on any page.
   ========================================================================= */
@media (min-width: 769px) {
  .nav-dropdown-wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Invisible hover bridge extending downwards from Extras button */
  .nav-dropdown-wrapper::after {
    content: '' !important;
    position: absolute !important;
    top: 100% !important;
    left: -20px !important;
    right: -20px !important;
    height: 25px !important;
    background: transparent !important;
    pointer-events: auto !important;
    z-index: 999 !important;
  }

  .nav-dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    margin-top: 4px !important;
    min-width: 270px !important;
    background: rgba(10, 14, 22, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(225, 29, 72, 0.35) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 24px rgba(225, 29, 72, 0.18) !important;
    padding: 8px !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s !important;
    z-index: 1050 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    pointer-events: none;
  }

  /* Invisible hover bridge extending upwards from dropdown menu */
  .nav-dropdown-menu::before {
    content: '' !important;
    position: absolute !important;
    top: -25px !important;
    left: -25px !important;
    right: -25px !important;
    height: 25px !important;
    background: transparent !important;
    pointer-events: auto !important;
    z-index: 1000 !important;
  }

  /* Active on hover, focus, or persistent click (.is-open) */
  .nav-dropdown-wrapper:hover .nav-dropdown-menu,
  .nav-dropdown-wrapper:focus-within .nav-dropdown-menu,
  .nav-dropdown-wrapper.is-open .nav-dropdown-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }

  .nav-dropdown-arrow {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .nav-dropdown-wrapper:hover .nav-dropdown-arrow,
  .nav-dropdown-wrapper:focus-within .nav-dropdown-arrow,
  .nav-dropdown-wrapper.is-open .nav-dropdown-arrow {
    transform: rotate(180deg) !important;
  }
  /* Dropdown Item Typography & Card Layout */
  .nav-dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 9px 12px !important;
    border-radius: 9px !important;
    text-decoration: none !important;
    color: #f8fafc !important;
    transition: all 0.15s ease !important;
  }

  .nav-dropdown-item:hover {
    background: rgba(225, 29, 72, 0.15) !important;
    text-decoration: none !important;
  }

  .nav-dropdown-icon {
    width: 28px !important;
    height: 28px !important;
    border-radius: 7px !important;
    background: rgba(225, 29, 72, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #e11d48 !important;
    flex-shrink: 0 !important;
  }

  .nav-dropdown-icon svg {
    display: block !important;
    flex-shrink: 0 !important;
  }

  .nav-dropdown-title {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    line-height: 1.25 !important;
    text-decoration: none !important;
  }

  .nav-dropdown-desc {
    font-size: 0.72rem !important;
    color: #94a3b8 !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    text-decoration: none !important;
  }

  .nav-dropdown-hub-link {
    border-top: 1px solid rgba(225, 29, 72, 0.22) !important;
    margin-top: 4px !important;
    padding-top: 8px !important;
    background: rgba(225, 29, 72, 0.08) !important;
  }
}
