/* =========================================
   RESPONSIVE.CSS - BẢN CHUẨN HOÀN CHỈNH CUỐI CÙNG
========================================= */

/* -----------------------------------------
   1. CHỈ BẬT DESKTOP KHI IFRAME RỘNG HƠN 480px 
   (Đảm bảo Form WP luôn giữ khung bo góc sang trọng)
----------------------------------------- */
@media (min-width: 481px) {
    .c-mob { display: none !important; }
    .c-desk { display: inline !important; }
}

/* -----------------------------------------
   2. GIAO DIỆN MOBILE CHUẨN (CHỈ KÍCH HOẠT DƯỚI 480px)
----------------------------------------- */
@media (max-width: 480px){
    /* KHUNG BẢO VỆ FORM TRÊN MOBILE */
    .flight-search-box { padding: 12px; border-radius: 10px; width: 100% !important; max-width: 100% !important; box-sizing: border-box !important;}
    .fs-field { padding: 10px; }
    .fs-field input { font-size: 14px; }
    .fs-icon { width: 22px; font-size: 14px; }
    .fs-divider { margin: 0 8px; }
    
    /* FIX GIAO DIỆN 3 NÚT CHUYẾN BAY (ÉP SÁT LỀ, CLICK NHỎ) */
    .fs-type { 
        display: flex !important; 
        justify-content: space-between !important; 
        align-items: center !important;
        gap: 0 !important; 
        width: 100% !important;
    }
    .fs-type label { 
        flex: 0 0 auto !important; 
        width: auto !important;
        padding: 4px 0 !important; 
        margin: 0 !important;
        white-space: nowrap !important; 
        font-size: 13px !important;
    }

    /* ĐIỂM ĐI - ĐIỂM ĐẾN NẰM NGANG */
    .route-box { display: flex !important; flex-direction: row !important; gap: 8px !important; }
    .route-box .fs-field { flex: 1 !important; width: 50% !important; margin-bottom: 0 !important; }
    .swap-btn { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: 30px !important; height: 30px !important; }
    
    .fs-options { display: flex !important; flex-direction: row !important; justify-content: space-between !important; align-items: center !important; }
    
    /* CHẶNG BAY & XÓA CHẶNG BỊ RỚT DÒNG (DÙNG CHO ĐA CHẶNG) */
    .leg-header { flex-wrap: nowrap !important; gap: 5px !important; }
    .leg-title { font-size: 13px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
    .remove-leg-btn { font-size: 11px !important; padding: 4px 8px !important; white-space: nowrap !important; flex-shrink: 0 !important; }

    /* ÉP 5 HÃNG BAY VỪA 1 DÒNG (BỎ CUỘN NGANG) */
    .fs-airlines { display: flex !important; flex-wrap: nowrap !important; justify-content: space-between !important; gap: 2px !important; width: 100% !important; box-sizing: border-box !important; overflow: hidden !important; padding-bottom: 0 !important; }
    .fs-airlines label { flex: 1 1 0% !important; min-width: 0 !important; padding: 4px 1px !important; display: flex !important; justify-content: center !important; align-items: center !important; gap: 2px !important; }
    .fs-airlines img { height: 12px !important; max-width: 100% !important; object-fit: contain !important; }
    .fs-airlines input[type="checkbox"] { margin: 0 !important; transform: scale(0.8) !important; flex-shrink: 0 !important; }
    
    /* CHỐNG ZOOM MÀN HÌNH KHI BẤM VÀO NÚT */
    .cabin-popup input[type="radio"], .cabin-option, .fs-option-row input[type="checkbox"] { touch-action: manipulation; }

    /* HÀNH KHÁCH & HẠNG GHẾ NẰM NGANG */
    .fs-row { display: flex !important; flex-direction: row !important; gap: 8px !important; margin-bottom: 12px !important; }
    .fs-row .fs-field { flex: 1 !important; width: 50% !important; margin-bottom: 0 !important; }

    /* POPUP SÂN BAY TRÊN MOBILE (ÉP TRÀN VIỀN 100%, XÓA BO GÓC) */
    #airport-popup { position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0 !important; z-index: 9999999 !important; display: none; flex-direction: column; }
    #airport-popup[style*="display: block"] { display: flex !important; }
    .airport-content { flex: 1; height: auto; }
    .airport-region, .airport-list { -webkit-overflow-scrolling: touch; }
    
    .c-desk { display: none !important; }
    .c-mob { display: inline !important; }

    /* HIỆU ỨNG LỊCH: CHỈ ÁP DỤNG TRÊN MOBILE (NỔI GIỮA MÀN HÌNH) */
    .flatpickr-calendar.open {
        position: fixed !important;
        top: 50% !important; 
        left: 50% !important;
        transform: translate(-50%, -50%) !important; 
        bottom: auto !important;
        z-index: 9999999 !important;
        box-shadow: 0 15px 50px rgba(0,0,0,0.5) !important; 
        border-radius: 12px !important;
        max-width: 90vw !important; 
    }
    .flatpickr-calendar.arrowTop::before, 
    .flatpickr-calendar.arrowTop::after,
    .flatpickr-calendar.arrowBottom::before, 
    .flatpickr-calendar.arrowBottom::after {
        display: none !important; 
    }
}