/* ============================================================
   ChatOS — Master Responsive CSS
   Covers: Landing Page, Auth Pages, Navigation, Footer
   Breakpoints: 1200 / 992 / 768 / 576 / 480 / 360px
   ============================================================ */

/* ---- Responsive Typography using clamp() ---- */
:root {
    --text-hero: clamp(28px, 5vw, 64px);
    --text-h2: clamp(22px, 3.5vw, 44px);
    --text-h3: clamp(18px, 2.5vw, 28px);
    --text-body: clamp(14px, 1.5vw, 16px);
    --text-sm: clamp(12px, 1.2vw, 14px);
    --section-padding: clamp(40px, 6vw, 96px);
    --container-px: clamp(16px, 4vw, 24px);
}

/* ---- Base Fixes ---- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
body { overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
table { max-width: 100%; }

/* ---- Container ---- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--container-px);
}

/* ============================================================
   DESKTOP ONLY ENFORCEMENT
   ============================================================ */
@media (min-width: 993px) {
    .mobile-menu-btn {
        display: none !important;
    }
    .mobile-nav-drawer {
        display: none !important;
    }
}

/* ============================================================
   NAVIGATION
   ============================================================ */

/* Mobile Hamburger Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-main);
    font-size: 24px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn:hover { background: rgba(96, 40, 255, 0.08); }

/* Mobile Menu Drawer */
.mobile-nav-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.mobile-nav-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.mobile-nav-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(300px, 85vw);
    height: 100%;
    background: white;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    box-shadow: -20px 0 60px rgba(0,0,0,0.15);
}

.mobile-nav-panel a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    color: var(--text-main);
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 48px;
}
.mobile-nav-panel a:hover { background: var(--primary-light, #f0ebff); color: var(--primary, #6028ff); }

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    color: #64748b;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.mobile-nav-drawer.open { display: block; }

/* ============================================================
   HERO SECTION
   ============================================================ */

.hero-content h1 { font-size: var(--text-hero); line-height: 1.1; }
.hero-content p, .hero-subtitle { font-size: clamp(14px, 1.8vw, 18px); }
.section-title { font-size: var(--text-h2); }
.section-subtitle { font-size: var(--text-body); }

/* ============================================================
   BUTTONS — Touch Targets
   ============================================================ */

.btn,
button:not(.icon-only) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Active state for mobile (replaces hover) */
@media (hover: none) {
    .btn:active { opacity: 0.8; transform: scale(0.98); }
}

/* ============================================================
   FORMS
   ============================================================ */

input, textarea, select {
    width: 100%;
    min-height: 48px;
    font-size: 16px; /* Prevents iOS zoom */
    border-radius: 8px;
}

/* ============================================================
   TABLES — Responsive Scroll
   ============================================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}
.table-responsive table {
    min-width: 600px;
}

/* ============================================================
   MODALS / POPUPS
   ============================================================ */

.modal, .popup, [class*="modal"], [class*="popup"] {
    max-width: 95vw !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}

/* Auth modals / card forms */
.auth-card, .login-card, .signup-card, .auth-box {
    width: min(480px, 95vw);
    max-width: 95vw;
}

/* ============================================================
   LARGE SCREENS (≤1200px)
   ============================================================ */
@media (max-width: 1200px) {
    .hero-container {
        gap: clamp(24px, 4vw, 48px);
    }

    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* ============================================================
   SMALL LAPTOP / TABLET LANDSCAPE (≤992px)
   ============================================================ */
@media (max-width: 992px) {
    .nav-links, .nav-actions {
        display: none;
    }
    .mobile-menu-btn {
        display: flex;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-subtitle { margin: 0 auto 32px; }
    .hero-features { justify-content: center; }
    .hero-buttons { justify-content: center; }
    .trust-indicator { justify-content: center; }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cta-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        align-items: center;
    }

    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-card.popular {
        transform: scale(1);
    }
}

/* ============================================================
   TABLET PORTRAIT (≤768px)
   ============================================================ */
@media (max-width: 768px) {
    section { padding: var(--section-padding) 0; }

    .hero-content h1 {
        font-size: clamp(28px, 7vw, 44px);
    }

    .hero-graphic, .hero-visual, .hero-image {
        display: none;
    }

    .steps-grid {
        flex-direction: column;
        gap: 20px;
    }
    .step-arrow { transform: rotate(90deg); padding: 8px 0; }

    .features-grid,
    .pricing-grid,
    .testimonials-track,
    .why-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }

    .stats-card {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .brand-col { grid-column: 1 / -1; }

    .mv-grid { grid-template-columns: 1fr; }

    .about-hero-container {
        flex-direction: column;
        text-align: center;
    }
    .about-hero-content { margin: 0 auto; }

    /* Pricing: 1 col */
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }
}

/* ============================================================
   LARGE MOBILE (≤576px)
   ============================================================ */
@media (max-width: 576px) {
    .hero-features {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .stats-card {
        grid-template-columns: 1fr;
    }

    .section-title { text-align: center; }
    .section-subtitle { text-align: center; }
}

/* ============================================================
   MOBILE (≤480px)
   ============================================================ */
@media (max-width: 480px) {
    .container { padding: 0 16px; }

    .hero-content h1 { font-size: clamp(24px, 8vw, 36px); }

    .floating-icons,
    .hero-badge-floating {
        display: none;
    }

    /* Collapse any 2-col grids to 1-col */
    [class*="grid-2"],
    [class*="two-col"],
    .two-column {
        grid-template-columns: 1fr !important;
    }

    .nav-cta { display: none; }
}

/* ============================================================
   SMALL MOBILE (≤414px)
   ============================================================ */
@media (max-width: 414px) {
    :root {
        --container-px: 14px;
    }

    .hero-content h1 { font-size: clamp(22px, 7vw, 32px); }

    .btn { padding: 12px 20px; font-size: 14px; }

    table { font-size: 12px; }
}

/* ============================================================
   VERY SMALL MOBILE (≤360px)
   ============================================================ */
@media (max-width: 360px) {
    :root { --container-px: 12px; }

    .hero-content h1 { font-size: 22px; }

    .mobile-nav-panel {
        width: 100%;
    }
}

/* ============================================================
   LANDSCAPE MODE ADJUSTMENTS
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 40px 0;
        min-height: auto;
    }

    .hero-graphic, .hero-image { display: none; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, header, footer, .mobile-menu-btn, #chatos-widget-container { display: none !important; }
    .main-content { margin: 0 !important; }
}
