/* =========================================
   Solara Lending Solutions – Mobile Optimisation
   Loaded after theme.css — overrides desktop styles.
   Primary breakpoint: 768 px (phones)
   Menu breakpoint:    900 px (matches theme.css)
   ========================================= */

/* ============================================
   1. TOP BAR — hide on phone, save real estate
   ============================================ */
@media (max-width: 768px) {
  .top-bar { display: none; }
}

/* ============================================
   2. HEADER — compact, 64 px tall
   ============================================ */
@media (max-width: 768px) {
  .header .container {
    height: 64px;
    padding: 0 16px;
  }
  .logo-icon {
    width: 38px; height: 38px;
    font-size: 17px; border-radius: 8px;
  }
  .logo-text .brand  { font-size: 15px; }
  .logo-text .tagline { display: none; }
}

/* ============================================
   3. MOBILE HAMBURGER BUTTON — larger tap target
   ============================================ */
@media (max-width: 900px) {
  .mobile-toggle {
    display: flex !important;
    align-items: center; justify-content: center;
    flex-direction: column; gap: 5px;
    width: 44px; height: 44px;
    border-radius: var(--radius);
    background: var(--light-bg);
    border: 1px solid var(--border);
    padding: 0;
    transition: background 0.2s;
  }
  .mobile-toggle:hover  { background: var(--border); }
  .mobile-toggle span   { width: 20px; height: 2px; border-radius: 2px; }

  /* Animated X when active */
  .mobile-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
  }
  .mobile-toggle.active span { background: white; }
  .mobile-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
  .mobile-toggle.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .mobile-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }
}

/* ============================================
   4. MOBILE NAV — full-height slide-in panel
   ============================================ */
@media (max-width: 900px) {

  /* Panel always in DOM — slides off-screen to the right */
  .nav {
    position: fixed !important;
    top: 0 !important; bottom: 0 !important;
    right: -105% !important;       /* off-screen */
    left: auto !important;
    width: min(85vw, 340px) !important;
    display: flex !important;       /* keep in layout */
    flex-direction: column !important;
    background: #fff !important;
    z-index: 1300 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 76px 0 120px !important;
    gap: 0 !important;
    max-height: none !important;
    box-shadow: none;
    transition: right 0.38s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  /* Accent stripe at top */
  .nav::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    z-index: 1;
  }

  /* Visible state */
  .nav.mobile-open {
    right: 0 !important;
    box-shadow: -8px 0 50px rgba(18,43,82,0.25) !important;
  }

  /* -------------------------------------------
     Close button injected by JS at top of panel
     ------------------------------------------- */
  .nav-close-btn {
    position: absolute;
    top: 18px; right: 18px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--light-bg);
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 17px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    z-index: 5;
  }
  .nav-close-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

  /* Brand inside panel (injected by JS) */
  .nav-panel-brand {
    padding: 0 24px 20px;
    border-bottom: 2px solid var(--light-bg);
    margin-bottom: 4px;
    font-size: 14px; font-weight: 700;
    color: var(--primary);
    display: flex; align-items: center; gap: 10px;
  }
  .nav-panel-brand i {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 15px;
    flex-shrink: 0;
  }

  /* -------------------------------------------
     Top-level nav items
     ------------------------------------------- */
  .nav-item {
    border-bottom: 1px solid var(--border);
  }
  .nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 17px 24px !important;
    min-height: 56px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--primary) !important;
    border-radius: 0 !important;
    background: transparent !important;
    white-space: normal !important;
    transition: background 0.18s, padding-left 0.18s !important;
  }
  .nav-link:hover,
  .nav-link.active {
    color: var(--secondary) !important;
    background: rgba(37,99,235,0.06) !important;
    padding-left: 28px !important;
  }
  .nav-link .caret { font-size: 13px !important; transition: transform 0.25s; }
  .nav-item.open .caret { transform: rotate(180deg); }

  /* -------------------------------------------
     Sub-menu (dropdown) inside panel — accordion
     ------------------------------------------- */
  .nav.mobile-open .dropdown {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    min-width: 0 !important;
    border-radius: 0 !important;
    padding: 4px 0 8px !important;
    background: #f0f4fa !important;
    display: none !important;
  }
  .nav.mobile-open .nav-item.open .dropdown { display: block !important; }

  .dropdown a {
    display: flex !important;
    align-items: center !important;
    padding: 13px 16px 13px 36px !important;
    font-size: 14px !important;
    color: var(--text-light) !important;
    min-height: 48px !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    transition: background 0.15s, padding-left 0.15s !important;
  }
  .dropdown a:last-child { border-bottom: none !important; }
  .dropdown a::before { display: none !important; } /* remove theme arrow */
  .dropdown a:hover {
    color: var(--secondary) !important;
    background: rgba(37,99,235,0.08) !important;
    padding-left: 44px !important;
  }
}

/* ============================================
   5. BACKDROP — darkens page behind open panel
   ============================================ */
.mobile-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .mobile-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(18,43,82,0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    cursor: pointer;
  }
  .mobile-backdrop.open {
    opacity: 1;
    visibility: visible;
  }
}

/* ============================================
   6. HERO — full viewport, phone-first layout
   ============================================ */
@media (max-width: 768px) {
  .hero {
    min-height: 100svh; /* modern */
    min-height: 100vh;  /* fallback */
    align-items: center;
  }
  /* Hide decorative right-side image on phone */
  .hero-pattern { display: none !important; }

  .hero .container {
    padding: 32px 20px 56px;
    display: flex;
    align-items: center;
    min-height: inherit;
  }

  .hero-content { max-width: 100%; }

  .hero-badge {
    font-size: 11px;
    padding: 5px 13px;
    margin-bottom: 18px;
  }

  .hero h1 {
    font-size: 34px !important;
    line-height: 1.15;
    margin-bottom: 16px;
  }

  .hero p {
    font-size: 16px;
    margin-bottom: 28px;
    line-height: 1.65;
  }

  /* Stack CTAs vertically, full width */
  .hero-btns {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .hero-btns .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 16px 24px !important;
    font-size: 16px !important;
  }

  /* Stats — 3 columns, divider lines between them */
  .hero-stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0 !important;
    margin-top: 32px;
    padding-top: 20px;
  }
  .hero-stat {
    text-align: center;
    padding: 8px 6px;
  }
  .hero-stat + .hero-stat {
    border-left: 1px solid rgba(255,255,255,0.2);
  }
  .hero-stat .num  { font-size: 22px !important; }
  .hero-stat .label { font-size: 10px !important; }
}

/* ============================================
   7. SECTION PADDING — breathable but not wasteful
   ============================================ */
@media (max-width: 768px) {
  .about-section,
  .about-story,
  .services-section,
  .service-detail,
  .process-section,
  .testimonials-section,
  .blog-section,
  .blog-page,
  .contact-page,
  .values-section,
  .team-section,
  .calculator-section { padding: 52px 0 !important; }

  .lenders-section { padding: 36px 0 !important; }
  .cta-strip       { padding: 44px 0 !important; }

  .section-header         { margin-bottom: 28px; }
  .section-header h2      { font-size: 24px !important; line-height: 1.25; }
  .section-header p       { font-size: 15px !important; }
}

/* ============================================
   8. PAGE BANNER — tighter on phone
   ============================================ */
@media (max-width: 768px) {
  .page-banner { padding: 44px 0 32px; }
  .page-banner h1 { font-size: 28px !important; }
}

/* ============================================
   9. ABOUT SECTION
   ============================================ */
@media (max-width: 768px) {
  .about-features { grid-template-columns: 1fr 1fr; gap: 12px; }
  .about-feature  { padding: 14px 12px; }
  .about-feature .icon { font-size: 18px; }
  .about-feature h4 { font-size: 13px; }
  .about-feature p  { font-size: 12px; }

  .about-content h2 { font-size: 26px !important; }
  .about-content p  { font-size: 15px; }
  .about-content .btn { width: 100%; justify-content: center; }
}

/* ============================================
   10. SERVICES GRID — 2 col phone, 1 col XS
   ============================================ */
@media (max-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 14px;
  }
  .service-card { padding: 24px 14px; }
  .service-icon {
    width: 56px; height: 56px;
    font-size: 22px;
    margin-bottom: 14px;
  }
  .service-card h3 { font-size: 14px; margin-bottom: 8px; }
  .service-card p  { font-size: 13px; margin-bottom: 14px; }
}
@media (max-width: 380px) {
  .services-grid { grid-template-columns: 1fr !important; }
}

/* ============================================
   11. PROCESS — vertical timeline on phone
   ============================================ */
@media (max-width: 768px) {
  .process-steps {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .process-steps::before { display: none; }

  .process-step {
    display: grid !important;
    grid-template-columns: 60px 1fr !important;
    gap: 16px !important;
    text-align: left !important;
    align-items: flex-start;
  }
  .step-num {
    width: 56px !important; height: 56px !important;
    font-size: 20px !important;
    margin: 0 !important;
    box-shadow: 0 0 0 3px var(--primary) !important;
  }
  .process-step h3 { font-size: 15px; margin: 6px 0 6px; }
  .process-step p  { font-size: 14px; }
}

/* ============================================
   12. LENDERS
   ============================================ */
@media (max-width: 768px) {
  .lenders-grid { gap: 10px 16px; }
  .lender-logo  { padding: 10px 18px; font-size: 13px; }
  .lenders-label { margin-bottom: 20px; font-size: 12px; }
}

/* ============================================
   13. TESTIMONIALS
   ============================================ */
@media (max-width: 768px) {
  .testimonials-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .testimonial-card  { padding: 24px 20px; }
  .testimonial-card p { font-size: 14px; line-height: 1.65; }
}

/* ============================================
   14. BLOG
   ============================================ */
@media (max-width: 768px) {
  .blog-grid      { grid-template-columns: 1fr !important; }
  .blog-card-img  { height: 180px; }
  .blog-card-body { padding: 20px; }
  .blog-card h3   { font-size: 16px; }
  .blog-section .btn { width: 100%; justify-content: center; }

  /* Blog list (index/archive) */
  .blog-list-card {
    grid-template-columns: 1fr !important;
  }
  .blog-list-img  { height: 180px; }
  .blog-list-body { padding: 20px; }
  .blog-list-body h2 { font-size: 18px; }
}

/* ============================================
   15. FORMS — iOS-safe (no auto-zoom)
   ============================================ */
@media (max-width: 768px) {
  /* Safari zooms when input font < 16px — always set 16px */
  .contact-form input,
  .contact-form textarea,
  .contact-form select,
  .sidebar-contact-form input,
  .sidebar-contact-form textarea,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px !important;
    padding: 15px 16px;
    border-radius: var(--radius);
  }

  /* Form rows: single column */
  .contact-form .form-row,
  .form-row { grid-template-columns: 1fr !important; gap: 0 !important; }

  .contact-form textarea { min-height: 120px; }

  /* Submit buttons: full width */
  .contact-form button[type="submit"],
  .contact-form-wrap .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 17px 24px !important;
    font-size: 16px !important;
    min-height: 54px;
  }

  /* Input focus: slightly bigger glow */
  .contact-form input:focus,
  .contact-form textarea:focus,
  .form-group input:focus,
  .form-group select:focus {
    box-shadow: 0 0 0 4px rgba(37,99,235,0.15) !important;
  }

  /* Labels: slightly larger */
  .form-group label { font-size: 15px; margin-bottom: 9px; }
}

/* ============================================
   16. CONTACT PAGE
   ============================================ */
@media (max-width: 768px) {
  .contact-grid { gap: 40px; }
  .contact-form-wrap h2 { font-size: 24px !important; }
  .contact-info-item { padding: 16px; }
  .contact-info-item h4 { font-size: 13px; }
  .contact-info-item p  { font-size: 15px; }
  .map-placeholder { height: 200px; margin-top: 16px; }
}

/* ============================================
   17. CTA STRIP
   ============================================ */
@media (max-width: 768px) {
  .cta-strip .container {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 20px !important;
  }
  .cta-strip h2 { font-size: 22px !important; margin-bottom: 4px; }
  .cta-strip p  { font-size: 15px; }
  .cta-strip .btn,
  .cta-strip a.btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 16px !important;
    font-size: 15px !important;
  }
  .cta-strip div[style*="display:flex"] {
    flex-direction: column !important;
    width: 100%;
  }
}

/* ============================================
   18. FOOTER — single column, space for CTA bar
   ============================================ */
@media (max-width: 768px) {
  .footer { padding-top: 44px; padding-bottom: 88px; /* space above CTA bar */ }
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  .footer-brand p { max-width: 100%; }
  .footer-col h4  { margin-bottom: 14px; }
  .footer-bottom  { flex-direction: column; text-align: center; gap: 10px; }
  .footer-bottom div[style*="display:flex"] {
    flex-wrap: wrap; justify-content: center;
  }
}

/* ============================================
   19. ABOUT PAGE — team / values
   ============================================ */
@media (max-width: 768px) {
  .values-grid { grid-template-columns: 1fr 1fr !important; gap: 14px; }
  .value-card  { padding: 22px 14px; }
  .value-icon  { font-size: 32px !important; margin-bottom: 12px; }
  .value-card h3 { font-size: 17px; }
  .value-card p  { font-size: 14px; }

  .team-grid { grid-template-columns: 1fr !important; }
  .team-card-img { height: 280px; }
  .team-card-body h3 { font-size: 18px; }
}

/* ============================================
   20. SERVICE DETAIL PAGE
   ============================================ */
@media (max-width: 768px) {
  .service-layout { grid-template-columns: 1fr !important; gap: 28px !important; }
  .service-main img { height: 220px !important; margin-bottom: 24px; }
  .service-main h2 { font-size: 22px !important; }
  .sidebar-widget  { padding: 20px; }
  .sidebar-widget h4 { font-size: 15px; }
  .benefits-list li { font-size: 14px; padding: 10px 0; }
}

/* ============================================
   21. CALCULATOR PAGE
   ============================================ */
@media (max-width: 768px) {
  .calculator-layout { grid-template-columns: 1fr !important; gap: 24px !important; }
  .calculator-card   { padding: 24px 20px; }
  .calculator-card h2 { font-size: 20px; }
  .result-value.main  { font-size: 26px !important; }
  .calc-nav           { margin-top: 20px; }
  .calc-nav-list a    { padding: 10px 12px; font-size: 13px; }
}

/* ============================================
   22. STICKY BOTTOM CTA BAR
   ============================================ */
.mobile-cta-bar { display: none; }

@media (max-width: 768px) {
  .mobile-cta-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1100;
    background: white;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.14);
    padding: 10px 14px;
    /* safe area for iPhone home bar */
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    align-items: center;
    /* slide in from bottom */
    transform: translateY(110%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .mobile-cta-bar.visible { transform: translateY(0); }

  .mobile-cta-bar .mcta-call {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius);
    padding: 13px 10px;
    font-size: 14px; font-weight: 700;
    min-height: 50px;
    text-decoration: none;
    transition: background 0.2s;
  }
  .mobile-cta-bar .mcta-call:hover  { background: var(--primary-dark); color: white; }

  .mobile-cta-bar .mcta-enquire {
    flex: 1.4;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--secondary);
    color: white;
    border-radius: var(--radius);
    padding: 13px 10px;
    font-size: 14px; font-weight: 700;
    min-height: 50px;
    text-decoration: none;
    transition: background 0.2s;
  }
  .mobile-cta-bar .mcta-enquire:hover { background: var(--primary); color: white; }

  /* Push scroll-top button above CTA bar */
  .scroll-top {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    right: 14px !important;
    width: 40px !important; height: 40px !important;
    font-size: 16px !important;
  }
}

/* ============================================
   23. SIDEBAR (mobile: full width)
   ============================================ */
@media (max-width: 768px) {
  .service-sidebar,
  .blog-sidebar { width: 100%; }

  .blog-page-layout { grid-template-columns: 1fr !important; gap: 32px !important; }
}

/* ============================================
   24. GENERAL READABILITY
   ============================================ */
@media (max-width: 768px) {
  /* Entry content in blog/pages */
  .entry-content p    { font-size: 15px; line-height: 1.75; margin-bottom: 18px; }
  .entry-content h2   { font-size: 22px; margin-top: 32px; }
  .entry-content h3   { font-size: 19px; margin-top: 24px; }
  .entry-content ul,
  .entry-content ol   { padding-left: 20px; }
  .entry-content blockquote { padding: 14px 18px; font-size: 15px; }

  /* Larger body text on phone */
  body { font-size: 15px; line-height: 1.65; }

  /* Prevent horizontal scroll from images */
  img { max-width: 100%; }
}
