/* ============================================================
   Mobile responsive patch - local clone
   Áp dụng khi width <= 768px (tablet/phone)
   ============================================================ */

html, body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

img {
    max-width: 100%;
    height: auto;
}

/* ====== <= 991px : tablet ====== */
@media (max-width: 991px) {
    .container,
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    .row > [class*="col-"] {
        padding-left: 6px;
        padding-right: 6px;
    }
}

/* ====== <= 768px : mobile ngang ====== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    h1 { font-size: 22px; }
    h2 { font-size: 19px; }
    h3 { font-size: 17px; }
    h4 { font-size: 15px; }

    /* Header / logo */
    header img,
    .awe-navigation img {
        max-height: 50px;
        width: auto;
    }

    /* Menu navigation */
    .awe-navigation,
    nav.awe-navigation {
        padding: 6px 0;
    }

    .awe-navigation ul {
        flex-wrap: wrap;
        justify-content: center;
        padding-left: 0;
    }

    .awe-navigation ul li {
        flex: 0 0 auto;
    }

    .awe-navigation ul li a {
        padding: 6px 10px;
        font-size: 13px;
    }

    /* Booking form - cột nhập sân bay */
    .col-city,
    .col-date {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px;
    }

    .div-departure-city,
    .div-arrival-city,
    .div-city {
        width: 100%;
    }

    /* City dropdown gợi ý */
    .div-city-list,
    .div-auto-suggest {
        max-height: 60vh;
        overflow-y: auto;
        width: 100% !important;
        left: 0 !important;
    }

    /* Nút search lớn để dễ tap */
    .btn-search,
    button.btn-search {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        margin-top: 8px;
    }

    /* Combobox người lớn / trẻ em / em bé */
    .cboAdult,
    .cboChild,
    .cboInfant {
        width: 100%;
        max-width: 100%;
    }

    /* Carousel banner */
    .carousel-inner img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    /* Card */
    .card {
        margin-bottom: 12px;
    }

    .card-header,
    .card-body {
        padding: 10px 12px;
    }

    /* Airline list */
    .airline-logo,
    .airline-logo-VJ {
        max-height: 32px;
        width: auto;
    }

    .airline .col,
    .available .col {
        font-size: 12px;
    }

    /* Nội dung tin tức */
    .col-12.news,
    .col-12.item {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Floating contact buttons (zalo, phone, fb) */
    .button-contact,
    .awe-social {
        bottom: 70px;
        right: 8px;
    }

    .button-contact a img,
    .awe-social a img {
        width: 42px;
        height: 42px;
    }

    /* Footer */
    .copyright,
    footer .container .row > div {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 12px;
        text-align: center;
    }

    .badge.dmca,
    .badge.visa,
    .badge.ripple {
        display: inline-block;
        margin: 4px;
    }

    /* Bảng giá / kết quả tìm chuyến */
    table {
        font-size: 12px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* Bỏ class d-xl-* hiển thị desktop-only */
    .d-xl-block { display: none !important; }
    .d-xl-inline { display: none !important; }
    .d-xl-none { display: block !important; }

    /* Easy booking section */
    .easy-booking .col-md-4,
    .easy-booking .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 12px;
    }

    /* Form input chung */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        width: 100%;
        font-size: 16px; /* >=16px tránh iOS zoom khi focus */
        padding: 10px;
        box-sizing: border-box;
    }

    /* Bank items */
    .bank-item {
        margin-bottom: 8px;
        padding: 8px;
    }
}

/* ====== <= 480px : phone dọc ====== */
@media (max-width: 480px) {
    .container,
    .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }

    body { font-size: 13px; }

    h1 { font-size: 20px; }
    h2 { font-size: 17px; }
    h3 { font-size: 15px; }

    .awe-navigation ul li a {
        padding: 5px 8px;
        font-size: 12px;
    }

    /* Hai cột nhỏ trong header chuyển sang 1 cột */
    .col-2.m-0.p-0,
    .col-1 {
        flex: 0 0 auto;
        max-width: none;
    }

    .col-10.p-1.pl-2,
    .col-10.p-1.pl-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .button-contact a img,
    .awe-social a img {
        width: 38px;
        height: 38px;
    }

    .btn-search { font-size: 15px; padding: 10px 14px; }

    /* Carousel cao vừa phải */
    .carousel-item img {
        max-height: 200px;
        object-fit: cover;
    }
}

/* ====== <= 360px : phone nhỏ ====== */
@media (max-width: 360px) {
    body { font-size: 12.5px; }

    .awe-navigation ul li a {
        padding: 4px 6px;
        font-size: 11.5px;
    }

    h1 { font-size: 18px; }
    h2 { font-size: 16px; }
}

/* ============================================================
   PATCH 2 — fix layout vỡ ở form đặt vé (col-7 form vs col-5 banner)
   ============================================================ */
@media (max-width: 768px) {
    /* Ép form (col-7) và banner carousel (col-5 pl-0) stack */
    #search-box,
    .row > .col-7,
    .row > .col-5.pl-0 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Banner carousel xuống dưới form */
    .row > .col-5.pl-0 {
        order: 2;
        margin-top: 12px;
        padding-left: 0 !important;
    }
    .row > .col-7 { order: 1; }

    /* Khung form */
    #search-box {
        padding: 12px 10px;
    }
    #search-box .title,
    #search-box h2.title {
        font-size: 16px;
        line-height: 1.3;
        margin-bottom: 10px;
        text-align: center;
    }

    /* Khởi hành / Điểm đến: stack 100% */
    #search-box .col-6.col-city {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px;
        padding: 0 !important;
    }
    #search-box .div-city {
        width: 100%;
    }
    #search-box .div-city input.txtCity {
        width: 100%;
        padding-left: 38px;
        font-size: 15px;
        height: 42px;
    }
    #search-box .air-dep,
    #search-box .air-arr {
        width: 22px;
        height: 22px;
        position: absolute;
        top: 50%;
        left: 10px;
        transform: translateY(-50%);
        pointer-events: none;
    }
    #search-box .div-city { position: relative; }

    /* Ngày đi / Ngày về */
    #search-box .col-date,
    #search-box .col-6.col-date {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding: 0 4px !important;
        margin-bottom: 8px;
    }
    #search-box .col-date input,
    #search-box .col-date .div-city input {
        width: 100%;
        height: 42px;
        padding-left: 32px;
        font-size: 14px;
    }

    /* 3 cột Người lớn / Trẻ em / Em bé: chia đều 3, label tự xuống dòng */
    #search-box .col-4,
    #search-box .row > .col-4 {
        flex: 0 0 33.3333% !important;
        max-width: 33.3333% !important;
        padding: 0 4px !important;
        margin-bottom: 6px;
    }
    #search-box label {
        font-size: 12px;
        font-weight: 600;
        margin-bottom: 4px;
        line-height: 1.3;
        white-space: normal;
        display: block;
    }
    #search-box label span {
        display: block;
        font-size: 10.5px;
        font-weight: 400;
        color: #6b7280;
        white-space: nowrap;
    }
    #search-box .cboAdult,
    #search-box .cboChild,
    #search-box .cboInfant {
        width: 100%;
        height: 38px;
        font-size: 14px;
        padding: 4px 6px;
    }

    /* Nút tìm chuyến bay full-width, không tràn */
    #search-box .btn-search,
    #search-box input.btn-search {
        width: 100%;
        max-width: 100%;
        font-size: 15px;
        padding: 12px 10px;
        margin-top: 8px;
        box-sizing: border-box;
        white-space: normal;
    }
    #search-box .col-5.mt-4.search-month {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-top: 8px !important;
    }
    #search-box .search-month {
        margin-top: 4px !important;
    }

    /* Banner carousel ảnh kích thước hợp lý */
    #myCarousel,
    .carousel.slide,
    .row > .col-5.pl-0 .carousel {
        max-width: 100%;
    }
    .row > .col-5.pl-0 .carousel-item img {
        width: 100%;
        height: auto;
        max-height: 240px;
        object-fit: contain;
    }

    /* Header / hotline nhỏ gọn */
    .hot-line {
        font-size: 15px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    #search-box .title { font-size: 14.5px; }
    #search-box label { font-size: 11.5px; }
    #search-box label span { font-size: 10px; }
    #search-box .col-4 { padding: 0 3px !important; }
    #search-box .cboAdult,
    #search-box .cboChild,
    #search-box .cboInfant { font-size: 13px; height: 36px; }
    #search-box .col-date input { font-size: 13px; padding-left: 28px; }
    #search-box .btn-search { font-size: 14px; padding: 11px 8px; }
}

/* ============================================================
   PATCH 3 — sticky header + alignment (mobile)
   ============================================================ */
#header-page {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
    transition: box-shadow .15s;
}

@media (max-width: 1199px) {
    #header-page .container {
        padding: 6px 12px;
    }

    /* Hàng header dạng flex: hamburger | logo | hotline */
    #header-page .header-ovelay {
        display: flex !important;
        align-items: center;
        gap: 10px;
        min-height: 56px;
        flex-wrap: nowrap;
    }

    /* Hamburger button hiện ra trên mobile (ghi đè inline style) */
    #header-page .toggle-menu-responsive {
        display: flex !important;
        align-items: center;
        justify-content: center;
        order: 0;
        padding: 8px;
        background: transparent;
        border: none;
        cursor: pointer;
        flex-shrink: 0;
        text-decoration: none;
    }
    #header-page .hamburger {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 24px;
        height: 18px;
    }
    #header-page .hamburger .item {
        display: block;
        height: 2.5px;
        background: #2563eb;
        border-radius: 2px;
        width: 100%;
        transition: transform .2s, opacity .2s;
    }
    /* Hamburger active (X icon) */
    #header-page.menu-open .hamburger .item-1 { transform: translateY(6.5px) rotate(45deg); }
    #header-page.menu-open .hamburger .item-2 { opacity: 0; }
    #header-page.menu-open .hamburger .item-3 { transform: translateY(-6.5px) rotate(-45deg); }

    /* Logo - co lại, căn trái */
    #header-page .logo {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        margin: 0;
    }
    #header-page .logo a {
        display: inline-flex;
        align-items: center;
    }
    #header-page .logo img {
        max-height: 42px;
        width: auto;
        display: block;
    }

    /* Hotline bên phải */
    #header-page .header-hotline {
        order: 2;
        display: flex;
        align-items: center;
        gap: 5px;
        white-space: nowrap;
        flex-shrink: 0;
        text-align: right;
        margin: 0;
    }
    #header-page .mobile-tongdai {
        font-size: 12px;
        color: #4b5563;
        display: inline-block !important;
    }
    #header-page .header-hotline h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
        line-height: 1;
    }
    #header-page .header-hotline h3 a {
        color: #ef4444;
        text-decoration: none;
    }

    /* Slide-out menu (mobile) - ẩn mặc định, hiện khi .menu-open */
    #header-page .awe-navigation,
    #header-page nav.awe-navigation.navigation-hide {
        position: fixed;
        top: 0;
        left: 0;
        width: 82%;
        max-width: 320px;
        height: 100vh;
        background: #fff;
        transform: translateX(-100%);
        transition: transform .25s ease-out;
        z-index: 1100;
        padding: 56px 16px 20px;
        box-shadow: 6px 0 24px rgba(0, 0, 0, .18);
        overflow-y: auto;
        margin: 0;
    }
    body.menu-open #header-page .awe-navigation,
    body.menu-open #header-page nav.awe-navigation.navigation-hide {
        transform: translateX(0);
    }

    #header-page .awe-navigation .menu-list,
    #header-page nav.awe-navigation ul.menu-list {
        display: block !important;
        margin: 0 !important;
        padding: 0;
        list-style: none;
    }
    #header-page .awe-navigation .menu-list li {
        display: block;
        flex: none;
        border-bottom: 1px solid #f1f5f9;
        padding: 0;
        margin: 0;
        text-align: left;
    }
    #header-page .awe-navigation .menu-list li a {
        display: block;
        padding: 12px 6px;
        color: #1f2937;
        text-decoration: none;
        font-weight: 500;
        font-size: 15px;
    }
    #header-page .awe-navigation .menu-list li a:hover,
    #header-page .awe-navigation .menu-list li.active a {
        color: #2563eb;
    }

    /* Overlay khi menu mở */
    body.menu-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        z-index: 1050;
        animation: fadein .2s;
    }
    @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

    /* Khi menu mở: khóa scroll body */
    body.menu-open { overflow: hidden; }

    /* Ẩn menu-top desktop trên mobile (đã có .d-xl-block) — giữ chắc chắn */
    #header-page .menu-top { display: none !important; }
}

@media (max-width: 480px) {
    #header-page .logo img { max-height: 36px; }
    #header-page .header-hotline h3 { font-size: 14.5px; }
    #header-page .mobile-tongdai { font-size: 11px; }
    #header-page .hamburger { width: 22px; }
}
