/* ============================================================
 * Avia.vn — Mobile patches
 * Layer applied AFTER prototype/styles.css to fix mobile UX
 * Audit findings: see NEXT-STEPS.md (P0)
 *
 * Load via templates/page-avia-fullscreen.php after styles.css.
 * ============================================================ */

/* === Airports dropdown (desktop hover; mobile drawer keeps single link) === */
.nav-dropdown { position: relative; display: inline-flex; }
.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.nav-dropdown-trigger .chev {
    display: inline-flex;
    transition: transform 150ms var(--ease-out);
}
.nav-dropdown.is-open .nav-dropdown-trigger .chev {
    transform: rotate(180deg);
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 260px;
    background: var(--color-white);
    border: 1px solid var(--color-border-strong);
    box-shadow: var(--shadow-pop);
    z-index: 100;
    padding: 6px 0;
}
.nav-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 16px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    color: var(--color-dark);
    text-decoration: none;
    border-bottom: 0;
}
.nav-dropdown-item:hover {
    background: var(--color-cream);
    color: var(--color-navy);
    border-bottom: 0;
}
.nav-dropdown-code {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 11px;
    color: var(--color-mute);
    letter-spacing: 0.08em;
}
.nav-dropdown-item:hover .nav-dropdown-code {
    color: var(--color-navy);
}
@media (max-width: 1100px) {
    .nav-dropdown-menu { display: none !important; }
    .nav-dropdown-trigger .chev { display: none !important; }
}

/* === Burger menu button (paired with mobile-nav.js) === */
.avia-burger {
    display: none;
    margin-left: auto;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-navy);
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}
.avia-burger svg { width: 22px; height: 22px; }
.avia-burger:hover { border-color: var(--color-navy); }

@media (max-width: 1100px) {
    .avia-burger { display: inline-flex; }
    .nav-cta { display: none; } /* drawer chứa CTA */
}

/* === Mobile drawer (slide-in nav) === */
.avia-drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}
.avia-drawer-backdrop.is-open { display: block; }

.avia-drawer {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 90vw;
    z-index: 100;
    background: var(--color-white);
    padding: 24px;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 240ms var(--ease-out);
}
.avia-drawer.is-open { display: flex; transform: translateX(0); }

.avia-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-divider);
}
.avia-drawer-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-navy);
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}
.avia-drawer-close:hover { border-color: var(--color-navy); background: var(--color-cream-deep); }

.avia-drawer nav { display: flex; flex-direction: column; }
.avia-drawer nav a {
    padding: 18px 0;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 18px;
    color: var(--color-dark);
    border-bottom: 1px solid var(--color-divider);
    text-decoration: none;
    border-bottom-color: var(--color-divider);
}
.avia-drawer nav a:hover { color: var(--color-orange); }
.avia-drawer .drawer-cta {
    margin-top: 24px;
    display: block;
    text-align: center;
    background: var(--color-orange);
    color: var(--color-white);
    padding: 18px 24px;
    font-family: var(--font-button);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
}
.avia-drawer .drawer-cta:hover { background: var(--color-orange-hover); }

/* Lock body scroll when drawer open */
body.avia-drawer-open { overflow: hidden; }

/* === Sticky bottom CTA bar (mobile only) === */
.avia-mobile-cta-bar {
    display: none;
}
@media (max-width: 768px) {
    .avia-mobile-cta-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 60;
        background: var(--color-white);
        border-top: 1px solid var(--color-border);
        padding: 10px 12px;
        gap: 8px;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    }
    .avia-mobile-cta-bar a {
        text-decoration: none;
        border-bottom: 0;
    }
    .avia-mobile-cta-bar .cta-book {
        flex: 1;
        background: var(--color-orange);
        color: var(--color-white);
        padding: 14px 12px;
        font-family: var(--font-button);
        font-weight: 700;
        font-size: 13px;
        letter-spacing: 1px;
        text-transform: uppercase;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }
    .avia-mobile-cta-bar .cta-wa {
        flex-shrink: 0;
        width: 48px;
        height: 48px;
        background: #25D366;
        color: var(--color-white);
        display: grid;
        place-items: center;
    }
    .avia-mobile-cta-bar .cta-wa svg { width: 24px; height: 24px; }
    /* Avoid overlap with sticky bar */
    body { padding-bottom: 76px !important; }
}

/* ============================================================
 * Phone-specific layout overrides (≤ 480px)
 * Original prototype only has 1 breakpoint at 1100px which leaves
 * too many issues on actual phone widths.
 * ============================================================ */
@media (max-width: 480px) {

    /* Top nav */
    .nav-inner { padding: 14px 16px; gap: 12px; }
    .brand { padding: 4px 0; } /* +tap area */

    /* Hero — smaller h1 */
    .hero-inner { padding: 40px 16px 48px; }
    .hero h1 { font-size: 38px; line-height: 1.08; }
    .hero p.lead { font-size: 15px; }
    .wa-btn { width: 100%; justify-content: center; padding: 14px 18px; }
    .hero-ctas { gap: 10px; margin-bottom: 36px; }

    /* Stats */
    .stat { padding: 14px 14px; }
    .stat-num { font-size: 24px; }
    .stat-label { font-size: 12px; }

    /* Booking card — stack header */
    .booking { padding: 24px 20px; }
    .booking::before { right: 16px; bottom: 16px; }
    .booking-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 20px;
    }
    .booking-title { font-size: 20px; }
    .field-grid { grid-template-columns: 1fr !important; gap: 14px; }
    .submit-btn { padding: 16px 20px; font-size: 13px; }

    /* Sections — tighter */
    .section { padding: 56px 16px; }
    .section-head { margin-bottom: 32px; }
    .section-head h2 { font-size: 26px; line-height: 1.2; }
    .section-head p { font-size: 15px; }

    /* Services tabs — horizontal scroll snap with edge fade */
    .services-tabs {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding-bottom: 4px;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        gap: 0;
        position: relative;
    }
    .services-tabs::-webkit-scrollbar { display: none; }
    .tab {
        scroll-snap-align: start;
        padding: 14px 16px;
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 13px;
    }
    .services-tabs::after {
        content: "";
        flex-shrink: 0;
        width: 24px;
    }

    /* Service card */
    .service-card .body { padding: 32px 24px 28px; }
    .service-card .title { font-size: 26px; }
    .price-amount { font-size: 36px; }

    /* Airports — 1 col to avoid 5th orphan */
    .airports { padding: 56px 16px; }
    .airports h2 { font-size: 26px; }
    .airports-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
        max-width: 100%;
    }
    .airport-card { padding: 18px 16px; text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
    .airport-code { font-size: 22px; margin-bottom: 0; }
    .airport-name { text-align: left; }
    .airport-wait { grid-column: 1 / -1; margin-top: 8px; padding-top: 8px; }

    /* How it works */
    .steps { gap: 32px; }
    .step-title { font-size: 22px; }
    .step-text { font-size: 14px; }

    /* Features grid */
    .feature-card { padding: 24px 20px; }
    .feature-card h4 { font-size: 18px; }

    /* Top picks */
    .pick-image { height: 140px; }
    .pick-body { padding: 20px; }
    .pick-body h4 { font-size: 17px; }
    .pick-price { font-size: 20px; }

    /* Testimonials */
    .testi { padding: 28px 24px; }
    .testi-body { font-size: 14px; }

    /* FAQ */
    .faq-q { padding: 18px 20px; font-size: 16px; }
    .faq-a { padding: 0 20px 18px; font-size: 14px; }

    /* CTA banner */
    .cta-banner { padding: 56px 20px; }
    .cta-banner h2 { font-size: 26px; line-height: 1.15; }
    .cta-banner p { font-size: 16px; }
    .chip { padding: 14px 18px; font-size: 12px; width: 100%; }
    .cta-chips { flex-direction: column; gap: 8px; }

    /* Footer — tap targets + 1 col stack */
    .footer { padding: 48px 16px 24px; }
    .footer-inner {
        grid-template-columns: 1fr !important;
        gap: 32px;
    }
    .footer ul { gap: 4px; }
    .footer a {
        display: inline-block;
        padding: 10px 0;
        min-height: 44px;
        line-height: 1.4;
    }
    .footer h5 { margin-bottom: 12px; }
    .footer-contact { gap: 10px; }
    .footer-contact > * {
        padding: 10px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 14px;
        text-align: center;
        margin-top: 36px;
    }
    .footer-bottom .links {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .footer-bottom .links a {
        padding: 8px 12px;
        min-height: 36px;
    }

    /* Partner logos */
    .partners { padding: 32px 16px; }
    .partner-logos { gap: 18px; justify-content: center; }
}

/* ============================================================
 * Tablet (481-768)
 * ============================================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .hero h1 { font-size: 46px; }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .airports-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .footer-inner { grid-template-columns: 1fr 1fr !important; }
}

/* ============================================================
 * Image lazy-load hint (browsers honour loading=lazy on <img>;
 * background-images need IntersectionObserver — out of scope here)
 * ============================================================ */
img { loading: lazy; }
