/**
 * ReportGen AI — Responsive fixes for all devices
 * Breakpoints: 480 / 640 / 768 / 900 / 1024
 */

/* Prevent horizontal scroll (common mobile bug) */
html, body {
  max-width: 100%;
  overflow-x: clip;
}
img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}
.hero-preview,
.demo-dash-embed,
[data-dashboard-mock] {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/* ——— ≤1024px ——— */
@media (max-width: 1024px) {
  .hero-grid-layout {
    gap: 2rem;
  }
  .why-best-grid,
  .feature-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ——— ≤900px (tablet / large phone landscape) ——— */
@media (max-width: 900px) {
  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  /* Nav drawer — light Apple style */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 1rem;
    gap: 0;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--apple-border, #d2d2d7);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    z-index: 120;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 0.875rem 0.5rem;
    width: 100%;
    min-height: 44px;
    border-bottom: 1px solid var(--apple-border, #d2d2d7);
    color: var(--apple-text, #1d1d1f) !important;
    font-size: 1rem !important;
  }
  .nav-links a:last-child { border-bottom: none; }
  .nav-links a.active::after { display: none; }
  .nav-toggle {
    display: flex !important;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }
  .nav-actions .btn-ghost { display: none; }
  .nav-actions .btn-ai,
  .nav-actions .btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  /* Hero */
  .hero-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 2rem;
  }
  .hero-preview {
    order: -1;
    max-width: 100%;
    margin: 0 auto;
  }
  .hero-enterprise {
    padding: 7rem 0 3rem !important;
    min-height: auto !important;
  }
  body.has-launch-banner .hero-enterprise {
    padding-top: 8rem !important;
  }
  body.banner-dismissed.has-launch-banner .hero-enterprise {
    padding-top: 6.5rem !important;
  }
  .hero-enterprise h1 {
    font-size: clamp(2rem, 8vw, 2.75rem) !important;
  }
  .hero-lead {
    font-size: 1.0625rem !important;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .trust-strip {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }
  .usp-rail {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
  .usp-section { padding: 2rem 0 2.25rem; }
  .hero-upload-zone {
    max-width: 100%;
    margin-top: 1.5rem;
  }
  .hero-copy {
    text-align: center;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-micro { font-size: 0.75rem; }
  .hero-preview .ai-dash { max-height: 380px !important; }

  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
  }

  .pricing-matrix {
    grid-template-columns: 1fr !important;
  }
  .pricing-tier.pro { transform: none !important; }

  .demo-modal-layout {
    grid-template-columns: 1fr !important;
  }
  .demo-modal-steps {
    flex-direction: row !important;
    flex-wrap: wrap;
  }
  .demo-modal-step { flex: 1; min-width: 100px; text-align: center; }

  .demo-showcase {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .launch-offer-card {
    flex-direction: column;
    text-align: center;
  }

  .explore-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .feature-row {
    grid-template-columns: 1fr !important;
  }

  .page-hero {
    padding-top: 6.5rem !important;
    padding-bottom: 1.5rem;
  }
  body.has-launch-banner .page-hero { padding-top: 7.5rem !important; }
  body.banner-dismissed.has-launch-banner .page-hero { padding-top: 5.5rem !important; }

  .solution-hero { padding-top: 6.5rem !important; }

  .section-compact { padding: 3.5rem 0; }
}

/* ——— ≤768px (phones + bottom nav) ——— */
@media (max-width: 768px) {
  .mobile-bottom-nav { display: flex !important; }

  body.has-mobile-nav .back-to-top {
    bottom: calc(4.5rem + env(safe-area-inset-bottom));
  }

  .why-best-highlight {
    grid-template-columns: 1fr !important;
  }
  .why-best-grid,
  .feature-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .launch-banner {
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 0.625rem 3rem 0.625rem 0.875rem;
    text-align: left;
  }

  .nav-actions { display: none; }

  .section-head h2 {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
  }
  .section-lead {
    font-size: 1rem !important;
  }

  .cta-band { padding: 3.5rem 0; }
  .cta-band .btn { width: 100%; max-width: 320px; }

  .enterprise-modal {
    max-height: calc(100vh - 2rem);
    border-radius: 16px;
  }
  .enterprise-modal-backdrop {
    padding: 0.75rem;
    align-items: flex-end;
  }

  /* Cookie above bottom nav */
  body.has-mobile-nav .cookie-consent.visible {
    bottom: calc(3.5rem + env(safe-area-inset-bottom));
  }

  .cookie-consent-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-consent-actions {
    width: 100%;
  }
  .cookie-consent-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ——— ≤640px ——— */
@media (max-width: 640px) {
  .explore-grid {
    grid-template-columns: 1fr !important;
  }
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
  .trust-strip {
    grid-template-columns: 1fr 1fr !important;
  }
  .usp-rail {
    grid-template-columns: 1fr !important;
  }
  .hero-examples {
    flex-direction: column;
    align-items: flex-start;
  }
  .industries-strip {
    justify-content: flex-start;
  }
}

/* ——— ≤480px (small phones) ——— */
@media (max-width: 480px) {
  .hero-enterprise h1 {
    font-size: 1.875rem !important;
  }
  .page-hero h1 {
    font-size: 1.75rem !important;
  }
  .trust-val { font-size: 1.25rem !important; }
  .mobile-bottom-nav a span {
    font-size: 0.5625rem;
  }
  .logo span { font-size: 0.9375rem; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-enterprise {
    min-height: auto !important;
    padding-top: 5rem !important;
    padding-bottom: 2rem !important;
  }
  .mobile-bottom-nav a {
    min-height: 44px;
  }
}

/* App workspace mobile polish */
@media (max-width: 768px) {
  body.app-body {
    overflow-x: clip;
  }
  .mobile-nav-toggle {
    bottom: calc(1rem + env(safe-area-inset-bottom));
    right: max(1rem, env(safe-area-inset-right));
    z-index: 130;
  }
  .ux-toast-region {
    left: 0.75rem !important;
    right: 0.75rem !important;
    bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
  }
}
