/* ==========================================================================
   ADP STORE — Responsive Design System (Mobile-First 2026)
   Breakpoints: xs <380px | sm 380-639 | md 640-1023 | lg 1024+
   ========================================================================== */

/* ── 0. Safe Area & Viewport Fixes ────────────────────────────────────────── */
:root {
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-left:   env(safe-area-inset-left, 0px);
    --safe-right:  env(safe-area-inset-right, 0px);
    --nav-height:  64px;
    --bottom-nav-height: 68px;
}

/* Prevent horizontal overflow everywhere */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ── 1. Bottom Navigation Bar (Mobile Only) ───────────────────────────────── */
#bottom-nav {
    background: rgba(5, 5, 7, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6), 0 -1px 0 rgba(255,255,255,0.05);
    padding-bottom: calc(8px + var(--safe-bottom));
    z-index: 990;
}

#bottom-nav .flex {
    padding-top: 6px;
    padding-bottom: 2px;
}

.bottom-nav-item {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 6px 4px 4px;
    border-radius: 12px;
    transition: color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
}

.bottom-nav-item span.material-symbols-outlined {
    font-size: 22px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item .text-\[9px\] {
    font-size: 9px;
    margin-top: 2px;
    opacity: 0.7;
}

.bottom-nav-item.active .text-\[9px\] {
    opacity: 1;
}

.bottom-nav-item.active span.material-symbols-outlined {
    transform: translateY(-2px) scale(1.12);
}

/* Active glow pill indicator */
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, #2563ff, #7c3aed);
    box-shadow: 0 0 12px rgba(37, 99, 255, 0.7);
}

/* Offset main content from bottom nav on mobile */
@media (max-width: 1023px) {
    main {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
    }
    footer {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 24px) !important;
    }
}

/* ── 2. Top Navigation Bar ────────────────────────────────────────────────── */
nav.fixed {
    padding-left: max(16px, var(--safe-left));
    padding-right: max(16px, var(--safe-right));
}

/* Compact logo on tiny screens */
@media (max-width: 380px) {
    nav .h-8 { height: 1.75rem; }
    nav .px-6 { padding-left: 12px; padding-right: 12px; }
}

/* ── 3. WhatsApp Float Button ─────────────────────────────────────────────── */
a[href*="wa.me"].fixed {
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
}

@media (min-width: 1024px) {
    a[href*="wa.me"].fixed {
        bottom: calc(24px + var(--safe-bottom));
    }
}

/* WA tooltip — hidden on mobile to avoid overflow */
@media (max-width: 639px) {
    a[href*="wa.me"].fixed > div {
        display: none !important;
    }
}

/* ── 4. Hero Section ──────────────────────────────────────────────────────── */
@media (max-width: 639px) {
    section.min-h-\[90vh\] {
        min-height: 85svh; /* svh = Small Viewport Height, avoids mobile browser chrome */
        padding-top: calc(var(--nav-height) + 32px);
        padding-left: 20px;
        padding-right: 20px;
    }
    /* Scale hero title more gracefully */
    section.min-h-\[90vh\] h1 {
        font-size: clamp(2rem, 9vw, 3.5rem);
        line-height: 1.1;
    }
    /* Description text tighter */
    section.min-h-\[90vh\] p {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
    /* Stack CTA buttons correctly */
    section.min-h-\[90vh\] .flex.flex-col.sm\:flex-row {
        width: 100%;
    }
    section.min-h-\[90vh\] a {
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    section.min-h-\[90vh\] {
        padding-top: calc(var(--nav-height) + 48px);
    }
}

/* ── 5. Advantages Bento Grid ─────────────────────────────────────────────── */
/* Mobile: stacked single column */
/* Tablet (md): 2 cols then 3 cols */
@media (max-width: 1023px) {
    /* Disable hover translate on touch devices */
    .glass-panel.hover\:-translate-y-2:hover {
        transform: none;
    }
}

@media (max-width: 639px) {
    #advantages .grid {
        grid-template-columns: 1fr;
    }
    #advantages .glass-panel {
        padding: 24px;
    }
}

/* ── 6. Pricing Grid (Plans) ──────────────────────────────────────────────── */
/* Mobile: 1 col  |  Tablet: 2 cols  |  Desktop: 4 cols */
.pricing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 640px) {
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (min-width: 1024px) {
    .pricing-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
}

/* Popular card — no scale on mobile/tablet (breaks grid) */
@media (max-width: 1023px) {
    .pricing-grid .popular-card,
    .pricing-grid [class*="md:scale-105"] {
        transform: none !important;
        z-index: 1;
    }
}

/* Disable hover scale on touch devices */
@media (hover: none) {
    .glass-panel.hover\:scale-\[1\.03\] {
        transform: none !important;
    }
    .hover\:-translate-y-2:hover {
        transform: none !important;
    }
}

/* ── 7. Plans Page Header ─────────────────────────────────────────────────── */
@media (max-width: 639px) {
    /* Page container top padding on mobile */
    main.flex-grow.pt-32 {
        padding-top: calc(var(--nav-height) + 28px);
        padding-left: 16px;
        padding-right: 16px;
    }
    /* Currency switcher full width */
    .glass-panel.p-1.rounded-full {
        width: 100%;
    }
    .glass-panel.p-1.rounded-full a {
        flex: 1;
        text-align: center;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    main.flex-grow.pt-32 {
        padding-top: calc(var(--nav-height) + 36px);
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ── 8. Contact Page ──────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    /* Stack info + form vertically on mobile */
    main.flex-grow.pt-32.pb-24.px-6.lg\:px-8.max-w-7xl.mx-auto.w-full.flex {
        flex-direction: column;
        gap: 32px;
        padding-top: calc(var(--nav-height) + 28px);
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: 32px;
    }
    /* Contact info grid — 1 col on small mobile */
    main .grid.grid-cols-1.sm\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    /* Side by side on tablet */
    main.flex-grow.pt-32.pb-24.px-6.lg\:px-8.max-w-7xl.mx-auto.w-full.flex {
        padding-top: calc(var(--nav-height) + 40px);
        gap: 32px;
    }
}

/* ── 9. Checkout Page ─────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    /* Reverse column order: payment first, then summary */
    .checkout-grid {
        display: grid;
        grid-template-columns: 1fr;
    }
    .checkout-col-summary {
        order: 2;
    }
    .checkout-col-payment {
        order: 1;
    }
    /* Promo code form responsive */
    .checkout-promo-form {
        flex-direction: column;
        gap: 10px;
    }
    .checkout-promo-form input {
        min-height: 48px;
    }
    .checkout-promo-form button {
        width: 100%;
        min-height: 48px;
    }
    /* Features grid in checkout */
    .checkout-features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 639px) {
    /* Checkout page outer padding */
    .flex-grow.pt-32.pb-24.px-6 {
        padding-top: calc(var(--nav-height) + 20px);
        padding-left: 16px;
        padding-right: 16px;
    }
    /* Payment buttons: ensure text doesn't truncate */
    .checkout-gateway-btn span[class*="text-xs"] {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 120px);
    }
}

/* ── 10. Testimonials ─────────────────────────────────────────────────────── */
@media (max-width: 639px) {
    .grid.grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    /* Testimonials: 1 col on tablet portrait, auto on landscape */
    section .grid.grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── 11. FAQ ──────────────────────────────────────────────────────────────── */
@media (max-width: 639px) {
    #faq {
        padding-left: 16px;
        padding-right: 16px;
    }
    #faq button {
        padding: 20px 16px;
    }
    #faq button span.font-headline-md {
        font-size: 0.875rem;
        line-height: 1.4;
    }
}

/* ── 12. Footer ───────────────────────────────────────────────────────────── */
@media (max-width: 639px) {
    /* Quality bar: 1 col on tiny screens */
    footer .grid.grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    /* Footer main grid: single column */
    footer .grid.grid-cols-1.md\:grid-cols-12 {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    /* Payment badges: wrap nicely */
    footer .flex.flex-wrap.gap-3 {
        gap: 8px;
    }
    /* Copyright: center everything */
    footer .flex.flex-col.md\:flex-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }
    footer .flex.gap-10 {
        gap: 24px;
    }
    footer .max-w-7xl {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (min-width: 640px) and (max-width: 767px) {
    /* Quality bar: 2 cols on small tablet */
    footer .grid.grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    /* Footer main: 2 col layout */
    footer .grid.grid-cols-1.md\:grid-cols-12 {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    footer .md\:col-span-4 { grid-column: span 2; }
    footer .md\:col-span-2 { grid-column: span 1; }
}

/* ── 13. Login Page ───────────────────────────────────────────────────────── */
@media (max-width: 639px) {
    main.flex-grow.pt-32.pb-24 {
        padding-top: calc(var(--nav-height) + 16px);
        padding-left: 12px;
        padding-right: 12px;
        min-height: 100svh;
    }
    .glass-panel.rounded-3xl.p-8.md\:p-10 {
        padding: 24px 20px;
        border-radius: 20px;
    }
    /* Social buttons full-width on xs */
    .grid.grid-cols-2.gap-4 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* ── 14. Dashboard (User area) ────────────────────────────────────────────── */
@media (max-width: 1023px) {
    /* Sidebar behavior */
    .dashboard-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 500;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
    }
    .dashboard-sidebar.open {
        left: 0;
    }
    .dashboard-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .dashboard-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(4px);
        z-index: 490;
    }
    .dashboard-overlay.active {
        display: block;
    }
}

/* ── 15. Toast Notifications ──────────────────────────────────────────────── */
@media (max-width: 639px) {
    #toast-container {
        left: 12px;
        right: 12px;
        bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px);
        align-items: stretch;
    }
    #toast-container > div {
        min-width: 0 !important;
        width: 100%;
    }
}

/* ── 16. Tablet-specific Layout Polish (640–1023px) ────────────────────────── */
@media (min-width: 640px) and (max-width: 1023px) {
    /* Ensure content doesn't hug edges */
    .max-w-7xl {
        padding-left: 24px;
        padding-right: 24px;
    }
    /* Section vertical rhythm on tablet */
    section.py-24 {
        padding-top: 64px;
        padding-bottom: 64px;
    }
    /* Hero section tablet */
    section.min-h-\[90vh\] h1 {
        font-size: clamp(2.5rem, 7vw, 4rem);
    }
}

/* ── 17. Scroll & Touch Improvements ──────────────────────────────────────── */
/* Momentum scrolling on iOS */
.overflow-y-auto, .overflow-y-scroll {
    -webkit-overflow-scrolling: touch;
}

/* Prevent content jump when scrollbar appears */
@media (min-width: 1024px) {
    html {
        scrollbar-gutter: stable;
    }
}

/* Larger touch targets on mobile */
@media (max-width: 1023px) {
    button, a {
        min-height: 40px;
    }
    .bottom-nav-item {
        min-height: 52px;
        min-width: 52px;
    }
}

/* ── 18. Input fields — iOS zoom prevention ───────────────────────────────── */
@media (max-width: 1023px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS auto-zoom */
    }
}

/* ── 19. Cinematic Loader — Mobile ────────────────────────────────────────── */
@media (max-width: 639px) {
    #cinematic-loader .h-16 {
        height: 3.5rem;
    }
    #cinematic-loader .h-16.md\:h-20 {
        height: 3.5rem;
    }
}

/* ── 20. Ambient Orbs — performance on mobile ─────────────────────────────── */
@media (max-width: 639px) {
    .ambient-orb {
        filter: blur(60px) !important; /* Lighter blur for mobile GPU */
        opacity: 0.25 !important;
    }
}

/* ── 21. Glass panels — readability on small screens ─────────────────────── */
@media (max-width: 639px) {
    .glass-panel {
        background: rgba(10, 10, 12, 0.75);
    }
}

/* ── 22. Section Headings — fluid scaling ─────────────────────────────────── */
.section-title {
    font-size: clamp(1.75rem, 5vw, 3rem);
}
.section-title-lg {
    font-size: clamp(2rem, 6vw, 3.75rem);
}

/* ── 23. Utility — Hide scrollbar but keep functionality ──────────────────── */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ── 24. Focus visible — Accessibility ───────────────────────────────────── */
:focus-visible {
    outline: 2px solid #2563ff;
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── 25. Bouquet Grid — Mobile-First Responsive Design ────────────────────── */
.bouquet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
@media (min-width: 380px) {
    .bouquet-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}
@media (min-width: 640px) {
    .bouquet-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (min-width: 768px) {
    .bouquet-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}
@media (min-width: 1200px) {
    .bouquet-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}
