/**
 * TASK #826915: Mobile Homepage Issues
 *
 * Fixes:
 * 1. Announcement banner text wraps gracefully at 375px (P2)
 * 2. Add search icon button in mobile nav header next to hamburger (P2)
 * 3. Align mobile + desktop CTA hierarchy: "Check Eligibility" primary on both (P2)
 */

/* ────────────────────────────────────────────────────────────
   ISSUE #1: Banner text wrapping at 375px viewport
   ────────────────────────────────────────────────────────────
   Current: text truncates at small viewport
   Fix: Reduce padding/font sizes, allow text to wrap naturally
*/
@media (max-width: 375px) {
  .hm-banner-section {
    padding: 0;
  }

  .hm-banner-inner {
    padding: 10px 12px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .hm-banner-text {
    min-width: 0;
    width: 100%;
    text-align: center;
  }

  .hm-banner-label {
    font-size: 0.65rem;
    margin-bottom: 4px;
  }

  .hm-banner-heading {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 3px;
    word-break: break-word;
    hyphens: auto;
  }

  .hm-banner-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    display: block;
  }

  .hm-banner-cta-wrap {
    width: 100%;
    flex-direction: column;
    gap: 6px;
  }

  .hm-banner-cta {
    width: 100%;
    padding: 10px 16px;
    font-size: 0.88rem;
    justify-content: center;
  }

  .hm-banner-fine {
    font-size: 10px;
    display: block;
  }
}

/* ────────────────────────────────────────────────────────────
   ISSUE #2: Mobile search icon button
   ────────────────────────────────────────────────────────────
   Add a magnifying glass icon button next to hamburger on mobile
   Positioned next to the nav-hamburger, left of the mobile pricing link
*/
@media (max-width: 900px) {
  /* Create new mobile search button container */
  .nav-mobile-search-btn {
    display: none !important;
  }
}

@media (max-width: 900px) {
  /* Show search button on mobile */
  .nav-brand-row {
    position: relative;
  }

  .nav-mobile-search-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    cursor: pointer;
    color: #64748b;
    flex-shrink: 0;
    margin: 0 4px;
    transition: color 0.2s;
  }

  .nav-mobile-search-btn:hover {
    color: #0f172a;
  }

  .nav-mobile-search-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Order: Logo | Search | Mobile Pricing | Hamburger */
  .nav-logo {
    order: 1;
    margin-right: auto;
  }

  .nav-mobile-search-btn {
    order: 2;
  }

  .nav-mobile-pricing {
    order: 3;
    margin: 0 4px;
  }

  .nav-hamburger {
    order: 4;
    margin-left: auto;
  }
}

/* ────────────────────────────────────────────────────────────
   ISSUE #3: CTA Hierarchy alignment (mobile + desktop)
   ────────────────────────────────────────────────────────────
   Desktop: Primary="Check Eligibility" (green button), Secondary="Go Pro" (text link)
   Mobile: Should be SAME order, not reversed

   Fix: Swap the visual hierarchy on mobile
   - "Check Eligibility" remains primary (green)
   - "Go Pro" becomes secondary (styled text link, not button)
*/
@media (max-width: 900px) {
  /* On mobile, swap the visual order and styling */

  /* Primary CTA: "Check Eligibility" - make prominent */
  .nav-auth-elig-cta {
    order: 1;
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    background: #16a34a !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    margin: 0 4px;
    transition: background 0.2s;
  }

  .nav-auth-elig-cta:hover {
    background: #15803d !important;
  }

  /* Secondary CTA: "Go Pro" - de-emphasize */
  .nav-mobile-pricing {
    order: 2;
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: transparent !important;
    color: #16a34a !important;
    -webkit-text-fill-color: #16a34a !important;
    border: 1.5px solid #d1d5db !important;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    margin: 0 4px;
    transition: all 0.2s;
  }

  .nav-mobile-pricing:hover {
    background: #f0fdf4 !important;
    border-color: #16a34a !important;
  }

  /* Hide desktop-only CTAs on mobile */
  .nav-check-elig-cta {
    display: none !important;
  }

  .nav-upgrade-btn {
    display: none !important;
  }

  .nav-plain-auth {
    display: none !important;
  }
}

/* Mobile nav: Right-align the controls (search, pricing, hamburger) */
@media (max-width: 900px) {
  .nav-brand-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .nav-logo {
    flex-shrink: 0;
    flex-grow: 0;
  }

  /* Right side: search + mobile-pricing + hamburger */
  .nav-mobile-search-btn,
  .nav-mobile-pricing,
  .nav-hamburger {
    flex-shrink: 0;
    flex-grow: 0;
  }
}

/* 375px breakpoint: Ensure search icon still visible and touchable */
@media (max-width: 375px) {
  .nav-mobile-search-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    margin: 0 2px !important;
  }

  .nav-mobile-search-btn svg {
    width: 18px;
    height: 18px;
  }

  .nav-mobile-pricing {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.7rem !important;
    margin: 0 2px !important;
  }

  .nav-hamburger {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    margin: 0 2px !important;
  }

  .nav-auth-elig-cta {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.75rem !important;
    margin: 0 2px !important;
  }
}
