/* ==========================================================
   ScoutRex -- Mobile / Phone Mode Stylesheet
   Breakpoints: 768px (tablet) | 560px (large phone) | 480px (phone) | 380px (small phone)
   ========================================================== */

/* -- GLOBAL ------------------------------------------------ */
@media (max-width: 768px) {
  .container { padding: 0 18px; }
  .section   { padding: 64px 0; }

  /* Shrink nav logo (inline style:72px needs !important) */
  .nav-logo img { height: 48px !important; }
  .nav-inner    { height: 64px; }

  /* Hero padding-top matches nav height */
  #hero { padding-top: 64px; }

  /* Footer bottom row -- stack */
  .footer-bottom {
    flex-direction: column;
    gap: 10px;
    padding: 20px 0;
    text-align: center;
  }
  .footer-bottom-right {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
  }

  .footer-brand p { max-width: 100%; }
  .stat-item { padding: 20px 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .section   { padding: 52px 0; }

  .nav-logo img { height: 40px !important; }
  .nav-inner    { height: 56px; }
  #hero         { padding-top: 56px; }

  .btn    { padding: 11px 20px; font-size: 14px; gap: 6px; }
  .btn-lg { padding: 14px 28px; font-size: 15px; }

  .section-title { font-size: 1.65rem !important; }
  .section-sub   { font-size: 0.97rem; }
}

@media (max-width: 360px) {
  .container { padding: 0 12px; }
  .section   { padding: 44px 0; }
  .btn-lg    { padding: 13px 22px; font-size: 14px; }
}


/* -- NAVBAR / MOBILE MENU ---------------------------------- */
@media (max-width: 768px) {
  .nav-cta   { display: none !important; }
  .nav-links { display: none !important; }
  .hamburger { display: flex !important; }

  /* Raise menu above navbar (1000), Rexi (9998) and cookie banner (9999) */
  .mobile-menu.open {
    z-index: 100000 !important;
    pointer-events: auto !important;
  }

  /* Mobile menu: scroll-safe so all links are always reachable */
  .mobile-menu {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    justify-content: flex-start !important;
    padding: 80px 20px 48px !important;
    gap: 14px !important;
  }
  /* Large tap targets + force pointer events so nothing above can block */
  .mobile-menu a {
    padding: 12px 20px;
    font-size: 1.1rem;
    display: block;
    width: 100%;
    text-align: center;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: rgba(249,115,22,0.18);
    touch-action: manipulation;
  }
  .mobile-menu button.theme-toggle {
    margin-top: 8px;
    touch-action: manipulation;
    pointer-events: auto !important;
  }
  /* Hide Rexi bubble while menu is open so it can't intercept touches */
  body.menu-open #rexi-bubble { display: none !important; }
  /* Lock body scroll on iOS so touch events go to the menu overlay */
  body.menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
  }
  /* Divider between nav links and account links */
  .mobile-menu .mobile-divider {
    width: 100%;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.12);
    margin: 4px 0;
    pointer-events: none;
  }
  .mobile-menu .mobile-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    padding: 0 20px;
    pointer-events: none;
  }
}

@media (max-width: 480px) {
  .mobile-menu {
    padding: 70px 16px 32px !important;
    gap: 10px !important;
  }
  .mobile-menu a { font-size: 1.05rem; }
}


/* -- INDEX -- HERO ----------------------------------------- */
@media (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr !important;
    padding: 56px 0 48px;
    gap: 36px;
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 3rem) !important;
    letter-spacing: -0.3px;
    margin-bottom: 18px;
  }

  .hero-sub {
    font-size: 1rem;
    margin-bottom: 28px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 12px;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-interface-body { padding: 18px; }
  .hi-score-val        { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .hero-content  { padding: 44px 0 36px; gap: 28px; }
  .hero-title    { font-size: 1.9rem !important; }
  .hero-badge    { font-size: 11px; padding: 5px 12px; }

  .hero-interface-body   { padding: 14px; }
  .hi-score-card         { padding: 14px; margin-bottom: 10px; }
  .hi-score-val          { font-size: 1.4rem; }
  .hi-score-label        { font-size: 10px; }
  .hi-match              { padding: 10px 12px; gap: 10px; }
  .hi-match-icon         { width: 28px; height: 28px; font-size: 12px; }
  .hi-match-name         { font-size: 12px; }
  .hi-match-role         { font-size: 10px; }
  .hi-match-pct          { font-size: 12px; }
}


/* -- INDEX -- VALUE PILLARS -------------------------------- */
@media (max-width: 768px) {
  .pillars-grid { margin-top: 36px; gap: 16px; }
  .pillar       { padding: 28px 24px; }
}

@media (max-width: 480px) {
  .pillar       { padding: 24px 20px; border-radius: 18px; }
  .pillar-icon  { width: 44px; height: 44px; margin-bottom: 18px; }
  .pillar-title { font-size: 1rem; }
}


/* -- INDEX -- PLATFORMS ------------------------------------ */
@media (max-width: 768px) {
  .platforms-grid { margin-top: 36px; gap: 16px; }
  .platform-card  { padding: 36px 28px; border-radius: 22px; }
}

@media (max-width: 480px) {
  .platform-card { padding: 28px 20px; border-radius: 18px; }
  .pc-name       { font-size: 1.5rem; }
  .pc-desc       { font-size: 14px; }
  .pc-deco       { width: 150px; height: 150px; bottom: -30px; right: -30px; }
}


/* -- INDEX -- AI SECTION ----------------------------------- */
@media (max-width: 768px) {
  #ai-section   { padding: 64px 0; }
  .ai-grid      { margin-top: 36px; gap: 32px; }
  .ai-steps     { gap: 16px; }
  .ai-step      { padding: 20px 18px; }
}

@media (max-width: 480px) {
  .ai-step          { padding: 16px 14px; gap: 12px; border-radius: 12px; }
  .ai-step-num      { width: 30px; height: 30px; font-size: 12px; }
  .ai-step-content h4 { font-size: 0.92rem; }
  .ai-step-content p  { font-size: 13px; }

  .ai-card          { padding: 20px 16px; }
  .ai-bar-label     { width: 80px; font-size: 11px; }
  .ai-bar-pct       { font-size: 11px; width: 30px; }
}


/* -- INDEX -- STATS ---------------------------------------- */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .stat-item {
    padding: 24px 12px;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
  }
  .stat-item:nth-child(2n) { border-right: none !important; }
  .stat-item:nth-last-child(-n+2) { border-bottom: none !important; }
  .stat-num   { font-size: 2.4rem; }
}

@media (max-width: 400px) {
  .stat-num   { font-size: 2rem; }
  .stat-label { font-size: 12px; }
}


/* -- INDEX -- CTA SECTION ---------------------------------- */
@media (max-width: 768px) {
  .cta-inner .section-title { font-size: 1.8rem !important; }

  .cta-actions {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .cta-actions .btn {
    width: 100%;
    max-width: 360px;
    justify-content: center;
  }
}


/* -- ABOUT PAGE -------------------------------------------- */
@media (max-width: 768px) {
  .mission-cards { gap: 16px; margin-top: 32px; }
  .values-grid   { gap: 16px; margin-top: 32px; }
  .mission-card  { padding: 24px 20px; border-radius: 14px; }
}

@media (max-width: 480px) {
  .mission-card h3 { font-size: 1rem; }
  .mission-card p  { font-size: 13.5px; }
  .story-content p { font-size: 0.97rem; }
}


/* -- TEAM PAGE --------------------------------------------- */
@media (max-width: 900px) {
  .team-grid { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 560px) {
  .team-grid {
    grid-template-columns: 1fr !important;
    max-width: 380px;
    margin: 0 auto;
  }
  .team-section { padding: 56px 0; }
  .team-card    { padding: 32px 24px 28px; }
  .team-intro   { margin-bottom: 44px; }
  .team-intro h2 { font-size: 1.6rem !important; }
}


/* -- CONTACT PAGE ------------------------------------------ */
@media (max-width: 768px) {
  .contact-layout     { grid-template-columns: 1fr !important; gap: 32px; margin-top: 32px; }
  .contact-form-wrap  { padding: 28px 20px; border-radius: 14px; }
}

@media (max-width: 480px) {
  .contact-form-wrap  { padding: 22px 16px; }
  .contact-info h3    { margin-bottom: 20px; }
}


/* -- PRICING PAGE ------------------------------------------ */
@media (max-width: 640px) {
  .pricing-preview-grid {
    grid-template-columns: 1fr !important;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 32px;
  }
}

@media (max-width: 480px) {
  .pricing-preview-card { padding: 28px 20px !important; border-radius: 18px !important; }
}


/* -- LOGIN / AUTH PAGES ------------------------------------ */
@media (max-width: 900px) {
  .login-left { display: none !important; }
  .login-right { flex: 1 !important; padding: 40px 24px !important; }
}

@media (max-width: 480px) {
  .login-right     { padding: 28px 16px !important; }
  .login-form-wrap { max-width: 100%; }
  .type-toggle     { margin-bottom: 24px; }
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }
}


/* -- ACCOUNT / DASHBOARD PAGE ------------------------------ */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr !important; }
  .grid-3 { grid-template-columns: 1fr 1fr !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr !important; }
  .grid-3 { grid-template-columns: 1fr !important; }
}


/* -- FOOTER (all pages) ------------------------------------ */
@media (max-width: 768px) {
  footer { padding: 56px 0 0; }

  /* Stack footer columns: 2 per row on tablet / large phone */
  .footer-top {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px 24px;
    padding-bottom: 32px;
  }

  /* Larger touch targets so links are easy to tap */
  .footer-col ul li { margin-bottom: 14px; }
  .footer-col ul li a {
    font-size: 15px;
    display: block;
    padding: 8px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Push footer bottom away from Rexi bubble (fixed bottom-right) */
  .footer-bottom {
    padding-bottom: 80px;
  }
}

@media (max-width: 480px) {
  /* Single column on phones so every link gets full width */
  .footer-top {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
  .footer-col-title { font-size: 11px; }
  .footer-col ul li a {
    font-size: 14px;
    padding: 10px 0;
    min-height: 44px;
  }
  .footer-bottom-left { font-size: 11px; }
  .footer-bottom-right a { font-size: 11px; }

  /* Extra bottom padding on small phones — Rexi is 52px + 16px gap */
  .footer-bottom {
    padding-bottom: 88px;
  }
}


/* -- HERO (all inner pages with .hero class) --------------- */
@media (max-width: 768px) {
  .hero          { min-height: 44vh; padding-top: 64px; }
  .hero h1       { font-size: clamp(1.8rem, 7vw, 2.5rem) !important; }
  .hero-cta      { flex-direction: column; align-items: center; gap: 10px; }
  .hero-cta .btn { width: 100%; max-width: 320px; justify-content: center; }
}

@media (max-width: 480px) {
  .hero          { min-height: 38vh; padding-top: 56px; }
  .hero h1       { font-size: 1.75rem !important; }
  .hero .section-sub { font-size: 0.95rem; }
}


/* -- REXI CHATBOT (all pages) ------------------------------ */

/*
 * CRITICAL FIX: #rexi-bubble is a flex container that holds both the
 * toggle button (52px) AND the panel (up to 360px wide, 500px tall).
 * Even when the panel is visually hidden (opacity:0, pointer-events:none),
 * the parent container still occupies that space with pointer-events:auto,
 * blocking taps on anything underneath — including footer links.
 * Fix: set pointer-events:none on the container and restore it only on
 * the toggle button and the open panel.
 */
#rexi-bubble {
  pointer-events: none !important;
}
#rexi-bubble .rexi-toggle {
  pointer-events: auto !important;
}
#rexi-bubble .rexi-panel.open {
  pointer-events: auto !important;
}

@media (max-width: 480px) {
  #rexi-bubble   { bottom: 16px; right: 16px; }
  .rexi-panel    { width: calc(100vw - 32px) !important; max-height: 420px; }
  .rexi-toggle   { width: 52px !important; height: 52px !important; }
  .rexi-toggle-icon img { width: 48px !important; height: 48px !important; }
  .rexi-suggestions { padding: 0 8px 8px; gap: 5px; }
  .rexi-chip        { font-size: 11px; padding: 5px 10px; }
}


/* -- PRODUCTS PAGE ----------------------------------------- */

@media (max-width: 768px) {
  /* Reduce section wrapper padding */
  .products-wrapper { padding: 56px 0 !important; }
  .products-stack   { gap: 40px !important; }

  /* Fix cell collapsing: flex-basis:0 in column flex collapses height to 0 */
  .product-cell {
    flex: none !important;
    height: auto !important;
    width: 100% !important;
    overflow: hidden !important;
  }
  /* Features also full-width */
  .product-features-outside { width: 100% !important; }

  /* Mockup margin reduction */
  .sr-mockup-wrap { margin-top: 28px !important; }

  /* Fix stats: 5 columns too tight -- use 3 */
  .sr-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 5px !important; }
  /* Hide last 2 stats to avoid overflow */
  .sr-stats .sr-stat:nth-child(4),
  .sr-stats .sr-stat:nth-child(5) { display: none !important; }

  /* Pipeline: 3 cols too tight -- show only jobs + candidates */
  .sr-pipeline { grid-template-columns: 1fr 1fr !important; gap: 7px !important; }
  .sr-pipeline > div:nth-child(3) { display: none !important; }

  /* Reduce feature list padding-top */
  .product-features-outside { padding-top: 4px !important; gap: 18px !important; }
}

@media (max-width: 560px) {
  /* Hide the full mockup on small phones -- too complex to read */
  .sr-mockup-wrap { display: none !important; }

  .products-wrapper { padding: 44px 0 !important; }
  .products-stack   { gap: 28px !important; padding: 0 14px !important; }

  /* Product cell: tighten it up without mockup */
  .product-cell { padding: 28px 20px !important; border-radius: 16px !important; }
  .product-cell .text-center .section-title { font-size: 1.5rem !important; }

  /* Features list tighter */
  .product-features-outside { gap: 14px !important; }
  .pf-icon  { font-size: 1.1rem !important; }
  .pf-body h4 { font-size: 0.85rem !important; }
  .pf-body p  { font-size: 0.8rem !important; }

  /* CTA button full width */
  .btn-outside {
    display: flex !important;
    width: 100% !important;
    justify-content: center !important;
    padding: 13px 20px !important;
    font-size: 14px !important;
  }

  /* Compare section steps -- stack vertically, hide arrows */
  .compare-steps { grid-template-columns: 1fr !important; gap: 0 !important; }
  .compare-step[style*="padding:20px 0"] { display: none !important; }
  .compare-step { padding: 16px 0 !important; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .compare-step:last-child { border-bottom: none !important; }
  .compare-step-num { font-size: 1.8rem !important; margin-bottom: 6px !important; }
  .compare-step p   { font-size: 0.9rem !important; }
}

@media (max-width: 480px) {
  .product-cell   { padding: 24px 16px !important; border-radius: 14px !important; }
  .products-stack { padding: 0 12px !important; }
}


/* -- SMALL PHONE SAFETY NET -------------------------------- */
@media (max-width: 360px) {
  img, video, iframe { max-width: 100%; }
  .hero-title   { font-size: 1.7rem !important; }
  .section-title { font-size: 1.5rem !important; }
  .btn { font-size: 13px; padding: 10px 18px; }
  .btn-lg { font-size: 14px; padding: 12px 22px; }
}


/* -- NAV DROPDOWN (desktop hover / click) ------------------ */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-dropdown > a {
  display: flex !important;
  align-items: center;
  gap: 3px;
}
.nav-dd-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  display: inline-block;
  opacity: 0.7;
}
.nav-dropdown:hover .nav-dd-arrow,
.nav-dropdown.open  .nav-dd-arrow {
  transform: rotate(180deg);
}
.nav-dd-menu {
  position: absolute;
  /* Start flush with the bottom of the trigger — no gap in the hover area.
     Visual spacing comes from padding-top so the mouse never leaves .nav-dropdown
     when moving straight down from the trigger into the menu. */
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid rgba(30,18,86,0.1);
  border-radius: 12px;
  /* 8px top-padding creates the visual gap while keeping hover continuous */
  padding: 8px 6px 6px;
  min-width: 165px;
  box-shadow: 0 8px 28px rgba(30,18,86,0.14);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 2000;
  pointer-events: auto;
}
.nav-dropdown:hover .nav-dd-menu,
.nav-dropdown.open  .nav-dd-menu {
  display: flex;
}
.nav-dd-menu a {
  padding: 9px 14px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--indigo, #1E1256) !important;
  white-space: nowrap;
  background: transparent !important;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  transition: background 0.15s !important;
}
.nav-dd-menu a:hover {
  background: var(--off-white, #F8F7FF) !important;
  color: var(--indigo, #1E1256) !important;
}
/* Dark mode */
html.dark .nav-dd-menu {
  background: #1E1B3A;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
html.dark .nav-dd-menu a {
  color: #C4BFDA !important;
}
html.dark .nav-dd-menu a:hover {
  background: #2D2850 !important;
  color: #fff !important;
}
/* Transparent navbar (hero background) */
#navbar:not(.scrolled) .nav-dd-menu {
  background: rgba(10,7,35,0.97);
  border-color: rgba(255,255,255,0.12);
}
#navbar:not(.scrolled) .nav-dd-menu a {
  color: rgba(255,255,255,0.85) !important;
}
#navbar:not(.scrolled) .nav-dd-menu a:hover {
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
}

/* Mobile: hide dropdown widget, show sub-links inline */
@media (max-width: 768px) {
  .nav-dropdown { display: none; }  /* desktop dropdown hidden on mobile */
  .mobile-sub-link {
    font-size: 0.9rem !important;
    padding-left: 36px !important;
    opacity: 0.75;
    margin-top: -6px !important;
  }
  .mobile-sub-link:hover { opacity: 1; color: var(--orange, #F97316) !important; }
}
