/* ═══════════════════════════════════════════════════════
   MOBILE-FIRST APP EXPERIENCE
   Bottom nav, gestures, touch-optimized, app-like feel
   ═══════════════════════════════════════════════════════ */

/* ─── PWA / APP META ─────────────────────────────────── */
html {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    overscroll-behavior-y: contain;
}
body {
    -webkit-text-size-adjust: 100%;
}

/* ─── BOTTOM NAV (mobile only) ───────────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    background: rgba(10, 10, 11, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
    min-width: 56px;
}
.bottom-nav-item i {
    font-size: 20px;
    transition: transform 0.2s ease;
}
.bottom-nav-item.active {
    color: var(--accent);
}
.bottom-nav-item.active i {
    transform: scale(1.1);
}
.bottom-nav-item:hover {
    color: var(--text-primary);
}
.bottom-nav-badge {
    position: absolute;
    top: 0;
    right: 6px;
    background: var(--accent);
    color: var(--text-inverse);
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── MOBILE HEADER (compact) ────────────────────────── */
@media (max-width: 768px) {
    /* Show bottom nav */
    .bottom-nav {
        display: block;
    }

    /* Add bottom padding for bottom nav */
    body {
        padding-bottom: 72px;
    }

    /* Compact navbar */
    .navbar {
        height: 52px;
    }
    .navbar .container {
        height: 52px;
    }
    .navbar-brand {
        font-size: 16px;
    }
    .brand-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* Hide desktop nav items on mobile */
    .navbar-menu {
        display: none !important;
    }
    .navbar-toggle {
        display: none !important;
    }

    /* Hide login/register text buttons on mobile (use bottom nav) */
    .navbar-actions .btn {
        display: none !important;
    }
    /* But keep icon-only nav buttons visible */
    .navbar-actions .nav-cart,
    .navbar-actions .nav-user-btn {
        display: flex !important;
    }
    .navbar-actions .nav-user-dropdown {
        display: block !important;
    }
    .navbar-actions .nav-user-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 4px !important;
    }
    .navbar-actions .nav-user-btn .fa-chevron-down {
        display: none;
    }

    /* Keep cart in top navbar */
    .nav-cart {
        width: 36px;
        height: 36px;
    }

    /* Hide topbar on mobile */
    .topbar {
        display: none;
    }

    /* Simplified footer on mobile (keep legal links) */
    .footer {
        display: block;
        margin-top: 40px;
        padding-bottom: 80px; /* space for bottom-nav */
    }
    .footer-top, .footer-nav, .footer-cta-section { display: none; }
    .footer-bottom { padding: 16px 0; }

    /* Hide whatsapp float (use bottom nav instead) */
    .whatsapp-float {
        bottom: 80px;
    }

    /* ─── APP-LIKE SECTIONS ───────────────────────── */
    .section-sm {
        padding: 16px 0 24px;
    }
    .section {
        padding: 32px 0;
    }
    .container {
        padding: 0 12px;
    }

    /* ─── HERO (compact mobile) ──────────────────── */
    .hero {
        padding: 60px 0 32px;
    }
    .hero-glow::before { width: 300px; height: 200px; filter: blur(40px); }
    .hero-glow::after { display: none; }
    .hero-grid-bg { display: none; }
    .hero-content { max-width: 100%; }
    .hero-line-1 { font-size: 22px !important; }
    .hero-line-2 { font-size: 28px !important; }
    .hero-title { letter-spacing: -0.5px; margin-bottom: 16px; }
    .hero-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
        line-height: 1.6;
    }
    .hero-subtitle br { display: none; }
    .hero-actions {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 20px;
    }
    .hero-actions .btn { width: 100%; }
    .hero-trust {
        gap: 8px 16px;
        margin-bottom: 24px;
    }
    .hero-trust-item { font-size: 10px; }
    .hero-stats {
        max-width: 100%;
        padding: 14px 16px;
    }
    .hero-stat { padding: 0 8px; }
    .hero-stat-value { font-size: 20px; }
    .hero-stat-label { font-size: 8px; letter-spacing: 0; }
    .hero-stat-divider { height: 20px; }

    /* ─── REDE PRICES (mobile) ─────────────────── */
    .rede-price-format { font-size: 8px; }
    .rede-price-value { font-size: 13px; }

    /* ─── AUTH GATE (checkout mobile) ──────────── */
    #form-login, #form-register { max-width: 100%; }

    /* ─── BRIEFING (mobile) ────────────────────── */
    .form-row { grid-template-columns: 1fr; }

    /* ─── RELEASE (mobile) ─────────────────────── */
    #release-content { padding: 24px !important; font-size: 14px !important; }
    #release-content h1 { font-size: 22px !important; }
    #release-content h2 { font-size: 16px !important; }

    /* ─── SHOWCASE 3D (mobile) ──────────────────── */
    .showcase-section { padding: 24px 0 32px; }
    .showcase-card { width: 160px; }
    .showcase-track { gap: 12px; padding: 12px 0 24px; }
    .showcase-ig-avatar { width: 30px; height: 30px; }
    .showcase-ig-header { padding: 8px 10px; gap: 8px; }
    .showcase-ig-user { font-size: 10px; }
    .showcase-ig-bio { font-size: 8px; }
    .showcase-ig-stats { padding: 8px 6px; }
    .showcase-ig-stats strong { font-size: 11px; }
    .showcase-ig-stats span { font-size: 7px; }
    .showcase-section::before, .showcase-section::after { width: 40px; }
    .showcase-reflection { height: 20px; }

    /* ─── REDE GRID (mobile) ────────────────────── */
    .rede-grid { grid-template-columns: 1fr; gap: 10px; }
    .rede-card { padding: 12px; }
    .rede-avatar { width: 40px; height: 40px; }
    .rede-username { font-size: 13px; }
    .rede-ig { display: none; }
    .rede-prices { gap: 4px; }
    .rede-price-value { font-size: 14px; }

    /* ─── FORMAT TOGGLE (mobile) ────────────────── */
    .format-toggle-btn { padding: 8px 14px; font-size: 12px; }

    /* ─── BENTO (mobile) ────────────────────────── */
    .bento-grid { grid-template-columns: 1fr; }
    .bento-featured, .bento-wide, .bento-guarantee { grid-column: span 1; grid-row: span 1; }
    .bento-number { font-size: 48px; }

    /* ─── CART MODAL (bottom sheet on mobile) ────── */
    .cart-modal {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 85vh;
        border-left: none !important;
        border-top: 1px solid var(--border);
        border-radius: 16px 16px 0 0;
        transform: translateY(110%) !important;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5) !important;
        visibility: hidden;
    }
    .cart-modal.open {
        transform: translateY(0) !important;
        visibility: visible;
    }
    .cart-modal-overlay.open {
        top: 52px;
    }
    /* Drag handle indicator */
    .cart-modal::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-hover);
        border-radius: 2px;
        margin: 10px auto 0;
        flex-shrink: 0;
    }
    .cart-modal-body {
        max-height: 45vh;
        overflow-y: auto;
    }
    .cart-modal-footer {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* ─── USER DROPDOWN (mobile position) ────────── */
    .nav-user-dropdown .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 72px;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 12px;
        z-index: 1200;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    }
    .nav-user-dropdown .dropdown-menu a {
        min-height: 44px;
        padding: 12px 16px;
    }

    /* ─── STICKY CTA (mobile) — above bottom nav ── */
    #sticky-cta { bottom: 60px !important; padding: 8px 12px; }
    #sticky-cta .sticky-text { display: none !important; }
    #sticky-cta .btn { font-size: 12px; padding: 8px 14px; }

    /* ─── EXPLORAR PAGE (mobile app feel) ────────── */
    .section-title {
        font-size: 22px !important;
        margin-bottom: 8px !important;
    }
    .text-muted.section-subtitle {
        font-size: 13px;
    }

    /* Search bar - full width, sticky feel */
    .filters-bar {
        gap: 8px;
        padding: 12px 0;
        margin-bottom: 16px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .filters-bar::-webkit-scrollbar {
        display: none;
    }
    .filter-chip {
        flex-shrink: 0;
        padding: 8px 16px;
        font-size: 13px;
    }

    /* ─── PAGE CARDS (app-style) ─────────────────── */
    .pages-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .page-card {
        border-radius: var(--radius);
        margin: 0;
    }
    .page-card-header {
        padding: 16px 16px 0;
    }
    .page-avatar {
        width: 46px;
        height: 46px;
        font-size: 14px;
    }
    .page-username {
        font-size: 14px;
    }
    .page-card-body {
        padding: 12px 16px;
    }
    .page-description {
        font-size: 13px;
        margin-bottom: 10px;
        -webkit-line-clamp: 2;
    }
    .page-stats {
        gap: 6px;
    }
    .page-stat {
        padding: 6px 4px;
    }
    .page-stat-value {
        font-size: 14px;
    }
    .page-stat-label {
        font-size: 9px;
    }
    .page-tags {
        margin-top: 10px;
    }
    .page-card-footer {
        padding: 12px 16px 16px;
    }
    .page-price {
        font-size: 18px;
    }

    /* Touch-friendly buttons */
    .btn-sm {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 36px;
    }
    .btn {
        min-height: 44px;
    }
    .add-to-cart-btn {
        min-height: 36px;
    }

    /* ─── MODAL (bottom sheet on mobile) ─────────── */
    .ig-modal-overlay .ig-modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
    }
    .ig-modal-overlay.active .ig-modal {
        transform: translateY(0);
    }
    /* Drag handle indicator */
    .ig-modal::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-hover);
        border-radius: 2px;
        margin: 10px auto 0;
    }
    .ig-modal-header {
        padding: 12px 16px;
    }
    .ig-modal-body {
        padding: 12px 16px;
    }
    .ig-modal-footer {
        padding: 12px 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        flex-wrap: wrap;
    }
    .ig-modal-footer .btn,
    .ig-modal-footer .ig-modal-ig-link {
        flex: 1 1 calc(50% - 5px);
        min-height: 44px;
        font-size: 13px;
    }

    /* ─── CART PAGE ──────────────────────────────── */
    .cart-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .cart-item {
        padding: 12px 0;
        gap: 12px;
    }
    .cart-summary {
        border-radius: var(--radius);
        padding: 20px;
        position: static;
    }

    /* ─── PACKAGE CARDS ─────────────────────────── */
    .package-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .package-card {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
    }
    .package-price-current {
        font-size: 36px;
    }

    /* ─── AUTH PAGES ─────────────────────────────── */
    .auth-page {
        padding: 20px 12px;
        align-items: flex-start;
        padding-top: 40px;
    }
    .auth-card {
        padding: 24px 20px;
        border-radius: var(--radius-lg);
    }

    /* ─── DASHBOARD ─────────────────────────────── */
    .dashboard {
        display: block;
    }
    .dashboard-sidebar {
        display: none;
    }
    .dashboard-content {
        padding: 16px 12px;
        margin-left: 0;
    }
    .dashboard-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-value {
        font-size: 22px;
    }

    /* ─── TABLES (horizontal scroll) ────────────── */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table {
        min-width: 600px;
    }

    /* ─── TOAST (mobile position) ──────────────── */
    .toast-notification {
        top: 60px !important;
        right: 12px !important;
        left: 12px !important;
        max-width: none !important;
    }

    /* ─── FAQ ────────────────────────────────────── */
    .faq-question {
        padding: 14px 16px;
        font-size: 14px;
    }

    /* ─── STEPS ──────────────────────────────────── */
    .steps-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* ─── FORM IMPROVEMENTS ─────────────────────── */
    .form-input, .form-select, .form-textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevents iOS zoom */
        min-height: 44px;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* ─── PAINEL EXCLUSIVO (home mockups) ──── */
    .section-dark [style*="grid-template-columns:1.2fr"],
    .section-dark [style*="grid-template-columns:1fr 1fr"],
    .section-dark [style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* ─── CHECKOUT MOBILE ──────────────────────── */
    #payment-methods {
        grid-template-columns: 1fr 1fr;
    }

    /* Checkout summary: single column, no sticky */
    .checkout-layout {
        grid-template-columns: 1fr !important;
    }
    .checkout-summary {
        position: static !important;
    }

    /* ─── PREVENT HORIZONTAL OVERFLOW ────────── */
    .main-content {
        overflow-x: hidden;
        max-width: 100vw;
    }
    img, video, iframe, embed, object {
        max-width: 100%;
        height: auto;
    }
    pre, code {
        overflow-x: auto;
        word-break: break-all;
    }

    /* ─── TABLES (global) ────────────────────── */
    table:not(.table-wrap table) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ─── TEXT OVERFLOW SAFETY ────────────────── */
    h1, h2, h3, h4 {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* ─── SMOOTH PAGE TRANSITIONS ──────────────── */
    .main-content {
        animation: fadeInUp 0.25s ease;
    }
}

/* ─── SMALLER PHONES ─────────────────────────────────── */
@media (max-width: 380px) {
    .container {
        padding: 0 10px;
    }
    .hero-title {
        font-size: 24px !important;
    }
    .page-card-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .page-card-footer > div:first-child {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .page-card-footer > div:last-child {
        display: flex;
        gap: 8px;
    }
    .page-card-footer > div:last-child .btn {
        flex: 1;
    }
    .bottom-nav-item {
        min-width: 48px;
        padding: 6px 8px;
        font-size: 9px;
    }
    .bottom-nav-item i {
        font-size: 18px;
    }
}

/* ─── ANIMATIONS ─────────────────────────────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes slideUpIn {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* ─── PULL INDICATOR (visual only) ───────────────────── */
.pull-indicator {
    text-align: center;
    padding: 8px;
    color: var(--text-muted);
    font-size: 12px;
    display: none;
}

/* ─── SWIPE HINT (first visit) ───────────────────────── */
.swipe-hint {
    display: none;
    text-align: center;
    padding: 8px 16px;
    background: var(--accent-subtle);
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--accent);
}
@media (max-width: 768px) {
    .swipe-hint {
        display: block;
    }
}

/* ─── SAFE AREA (notched phones) ─────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    body {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }
}
