/* ==========================================================================
   1860 Travels — Booking-Grade Language Switcher & Auto-Detect Toast
   Matches 1860-theme.css (navy topbar, light mobile navbar, amber/blue accents)
   ========================================================================== */

.t-lang-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.t-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--font, 'Montserrat', sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    line-height: 1.2;
    white-space: nowrap;
}

.t-lang-btn:hover,
.t-lang-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

.t-lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 12px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.t-lang-flag svg {
    display: block;
    width: 18px;
    height: 12px;
}

.t-lang-caret {
    width: 9px;
    height: 9px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.t-lang-btn[aria-expanded="true"] .t-lang-caret {
    transform: rotate(180deg);
}

/* Popover Card (Booking.com / Expedia style) */
.t-lang-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 230px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(10, 14, 30, 0.22), 0 2px 8px rgba(10, 14, 30, 0.08);
    padding: 8px;
    z-index: 2500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    text-align: left;
}

.t-lang-popover.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.t-lang-pop-head {
    padding: 6px 10px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 6px;
}

.t-lang-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font, 'Montserrat', sans-serif);
    color: #0f172a;
    transition: background 0.15s ease;
}

.t-lang-opt:hover {
    background: #f1f5f9;
}

.t-lang-opt.is-active {
    background: rgba(4, 142, 211, 0.09);
    color: #048ED3;
}

.t-lang-opt-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    flex: 1;
}

.t-lang-opt-name {
    font-size: 12.5px;
    font-weight: 700;
}

.t-lang-opt-sub {
    font-size: 10.5px;
    font-weight: 500;
    color: #64748b;
}

.t-lang-opt.is-active .t-lang-opt-sub {
    color: #048ED3;
    opacity: 0.85;
}

.t-lang-check {
    width: 16px;
    height: 16px;
    color: #048ED3;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.t-lang-opt.is-active .t-lang-check {
    opacity: 1;
    transform: scale(1);
}

.t-lang-pop-foot {
    margin-top: 6px;
    padding: 8px 10px 4px;
    border-top: 1px solid #f1f5f9;
    font-size: 10.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.t-lang-reset-btn {
    background: none;
    border: none;
    padding: 0;
    color: #048ED3;
    font-weight: 700;
    font-size: 10.5px;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}

.t-lang-reset-btn:hover {
    color: #0369a1;
}

/* Mobile Header Slot (<=600px, light navbar) */
.t-nav-lang-slot {
    display: inline-flex;
    align-items: center;
}

.t-nav-lang-slot:empty {
    display: none;
}

.t-nav-actions .t-lang-btn {
    background: var(--bg-2, #edece6);
    color: var(--text-dk, #1a1b13);
    border-color: rgba(0, 0, 0, 0.08);
    padding: 5px 8px;
    font-size: 11.5px;
}

.t-nav-actions .t-lang-btn:hover,
.t-nav-actions .t-lang-btn[aria-expanded="true"] {
    background: #e2e0d8;
    color: #0f172a;
}

.t-nav-actions .t-lang-popover {
    right: -28px;
}

/* Mobile Drawer Language Toggle Row */
.t-m-lang-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 6px 14px 10px;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
}

.t-m-lang-label {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.t-m-lang-pills {
    display: inline-flex;
    background: #ffffff;
    border-radius: 8px;
    padding: 2px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    gap: 2px;
}

.t-m-lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    font-family: var(--font, 'Montserrat', sans-serif);
    transition: all 0.15s ease;
}

.t-m-lang-pill.is-active {
    background: #048ED3;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(4, 142, 211, 0.3);
}

/* Booking.com-style Auto-Detect Welcome Toast */
.t-lang-toast {
    position: fixed;
    left: 20px;
    bottom: 22px;
    z-index: 9990;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 40px);
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(10, 14, 30, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
    font-family: var(--font, 'Montserrat', sans-serif);
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.t-lang-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.t-lang-toast-flag {
    display: inline-flex;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.t-lang-toast-msg {
    color: rgba(248, 250, 252, 0.92);
}

.t-lang-toast-switch {
    background: #F3A316;
    color: #0f172a;
    border: none;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background 0.15s ease;
}

.t-lang-toast-switch:hover {
    background: #d98e0f;
}

.t-lang-toast-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.t-lang-toast-close:hover {
    color: #ffffff;
}

@media (max-width: 600px) {
    .t-lang-toast {
        left: 12px;
        right: 12px;
        bottom: 14px;
        border-radius: 14px;
        justify-content: space-between;
    }
}

/* Keep navbar single-line on medium laptops when French labels are slightly longer */
@media (min-width: 992px) and (max-width: 1280px) {
    html[data-site-lang="fr"] .t-nav-link {
        padding: 7px 6px;
        font-size: 9.8px;
        gap: 4px;
    }
}

/* ==========================================================================
   Mobile Layout Protection (<= 768px / <= 600px / <= 420px)
   Prevents longer French labels & the added mobile language button from
   crowding the navbar, misaligning form rows, or scattering cards/buttons.
   ========================================================================== */

@media (max-width: 768px) {
    /* Keep 2-col and 3-col mobile booking fields vertically aligned even if French labels are longer */
    html[data-site-lang="fr"] .t-bbar-field label {
        font-size: 9.5px;
        letter-spacing: 0.02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    /* Booking tabs: crisp fit for "Vols / Hôtels / Circuits / Visa" */
    html[data-site-lang="fr"] .t-bbar-tab {
        font-size: 10px;
        letter-spacing: 0.01em;
        gap: 4px;
        padding: 9px 3px;
        white-space: nowrap;
    }

    html[data-site-lang="fr"] .t-bbar-tab svg {
        width: 13px;
        height: 13px;
        flex-shrink: 0;
    }

    /* Deal card footers, section headers, and buttons stay aligned instead of colliding */
    html[data-site-lang="fr"] .t-deal-footer {
        gap: 8px;
        flex-wrap: wrap;
    }

    html[data-site-lang="fr"] .t-deal-btn {
        padding: 8px 12px;
        font-size: 11.5px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    html[data-site-lang="fr"] .t-sec-hdr {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 10px;
    }

    html[data-site-lang="fr"] .t-view-all {
        padding: 8px 13px;
        font-size: 11px;
    }

    /* Prevent French CTA/explore headlines from overflowing fixed-height banners */
    html[data-site-lang="fr"] .t-explore-title {
        font-size: clamp(22px, 6vw, 32px);
        margin-bottom: 16px;
    }

    html[data-site-lang="fr"] .t-explore-btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    html[data-site-lang="fr"] .t-cta-btns {
        gap: 10px;
    }

    html[data-site-lang="fr"] .t-cta-btn-a,
    html[data-site-lang="fr"] .t-cta-btn-b {
        padding: 12px 18px;
        font-size: 13px;
        max-width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* General button/pill safety net across Flights, Hotels, Tours, Visa, eSIM & Transfers */
    html[data-site-lang="fr"] .btn,
    html[data-site-lang="fr"] .biz-btn,
    html[data-site-lang="fr"] .t-bbar-search,
    html[data-site-lang="fr"] .t-m-foot-btn {
        max-width: 100%;
        white-space: normal;
        line-height: 1.25;
        text-align: center;
    }

    /* Filter chips / pills wrap gracefully instead of clipping off-screen */
    html[data-site-lang="fr"] .t-bbar-extras {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* ── Cross-site booking pages: Flights, Hotels, Tours, Visa, Insurance,
          Transfers, Fast Track, eSIM, Top Deals, Top Destinations, Profile & Help ── */

    /* Flights & Checkout (booking-flow.css) */
    html[data-site-lang="fr"] .t-auth-hint-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .t-auth-hint-btn,
    html[data-site-lang="fr"] .t-discount-apply-btn,
    html[data-site-lang="fr"] .t-fdet-hero-chip {
        white-space: normal;
        text-align: center;
        line-height: 1.25;
        max-width: 100%;
    }
    html[data-site-lang="fr"] .t-price-stack .t-promo-badge {
        white-space: normal;
        max-width: 100%;
        text-align: center;
    }

    /* Hotels (_HotelData, Hotel/Index) */
    html[data-site-lang="fr"] .ht-card__footer,
    html[data-site-lang="fr"] .rf-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .es-edit-btn,
    html[data-site-lang="fr"] .rf-apply-btn {
        white-space: normal;
        line-height: 1.25;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Tours & Activities */
    html[data-site-lang="fr"] .act-hero-actions,
    html[data-site-lang="fr"] .card-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .btn-load-more,
    html[data-site-lang="fr"] .nir-btn,
    html[data-site-lang="fr"] .act-hero-btn,
    html[data-site-lang="fr"] .modern-cart-btn,
    html[data-site-lang="fr"] .read-more-btn {
        max-width: 100%;
        white-space: normal;
        line-height: 1.25;
        text-align: center;
    }

    /* Top Deals & Top Destinations */
    html[data-site-lang="fr"] .top-deal-footer,
    html[data-site-lang="fr"] .destination-card-footer,
    html[data-site-lang="fr"] .tour-card-footer,
    html[data-site-lang="fr"] .td-filter-row {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .top-deal-cta,
    html[data-site-lang="fr"] .buy-now-cta,
    html[data-site-lang="fr"] .btn-explore-now,
    html[data-site-lang="fr"] .td-banner-btn,
    html[data-site-lang="fr"] .td-cta-btn {
        padding: 8px 13px;
        font-size: 11.5px;
        white-space: nowrap;
        max-width: 100%;
    }

    /* Travel eSIM */
    html[data-site-lang="fr"] .esim-subnav {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .esim-subnav > div {
        flex-wrap: wrap;
        gap: 8px 12px;
    }
    html[data-site-lang="fr"] .esim-filters label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    html[data-site-lang="fr"] .esim-pill {
        white-space: normal;
        line-height: 1.25;
    }

    /* Airport Fast Track */
    html[data-site-lang="fr"] .ftk-tabs,
    html[data-site-lang="fr"] .ftk-sh-tabs,
    html[data-site-lang="fr"] .ftk-chips,
    html[data-site-lang="fr"] .ftk-chips2,
    html[data-site-lang="fr"] .ftk-sh-foot {
        flex-wrap: wrap;
        gap: 6px;
    }
    html[data-site-lang="fr"] .ftk-tab,
    html[data-site-lang="fr"] .ftk-chip,
    html[data-site-lang="fr"] .ftk-chip2,
    html[data-site-lang="fr"] .ftk-btn {
        font-size: 11.5px;
        line-height: 1.25;
        white-space: normal;
        text-align: center;
        max-width: 100%;
    }

    /* Global Transfer */
    html[data-site-lang="fr"] .tfr-filters,
    html[data-site-lang="fr"] .tfr-continue-bar {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .tfr-chip,
    html[data-site-lang="fr"] .tfr-continue-btn {
        font-size: 12px;
        line-height: 1.25;
        white-space: normal;
        text-align: center;
        max-width: 100%;
    }

    /* Travel Insurance & Visa */
    html[data-site-lang="fr"] .ins-steps {
        flex-wrap: wrap;
        gap: 6px 10px;
    }
    html[data-site-lang="fr"] .ins-step {
        font-size: 11px;
    }
    html[data-site-lang="fr"] .visa-verdict-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .visa-btn,
    html[data-site-lang="fr"] .ins-cta {
        white-space: normal;
        line-height: 1.25;
        text-align: center;
        max-width: 100%;
    }

    /* Customer Profile, History, Help Center, About & Status Tracker */
    html[data-site-lang="fr"] .profile-nav .nav-item {
        font-size: 11.5px;
        padding: 9px 8px;
        gap: 6px;
    }
    html[data-site-lang="fr"] .wishlist-card-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    html[data-site-lang="fr"] .history-card .refund-btn,
    html[data-site-lang="fr"] .history-card .receipt-btn,
    html[data-site-lang="fr"] .phc-btn,
    html[data-site-lang="fr"] .btn-search {
        white-space: normal;
        line-height: 1.25;
        text-align: center;
        max-width: 100%;
    }
    html[data-site-lang="fr"] .fs-status-pill,
    html[data-site-lang="fr"] .tier-chip,
    html[data-site-lang="fr"] .dg-badge {
        max-width: 100%;
        white-space: normal;
        line-height: 1.25;
    }

    /* Look What I Found (BARI spotlight strip — 168px mobile cards) */
    html[data-site-lang="fr"] .lwif-badge {
        padding: 4px 10px;
        font-size: 9.5px;
        letter-spacing: 0.06em;
    }
    html[data-site-lang="fr"] .lwif-card-pick {
        font-size: 8px;
        padding: 2px 7px;
        letter-spacing: 0.01em;
        max-width: 62%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    html[data-site-lang="fr"] .lwif-card-sale {
        font-size: 9.5px;
        padding: 2px 7px;
        white-space: nowrap;
    }
}

@media (max-width: 600px) {
    /* Compact mobile navbar so Logo + Currency + Lang + Connexion + Menu never overflow */
    .t-navbar-inner {
        padding: 0 12px;
        gap: 5px;
    }

    .t-nav-logo img {
        height: 38px;
    }

    .t-nav-actions {
        gap: 5px;
        min-width: 0;
        flex-shrink: 1;
    }

    .t-nav-actions .t-tb-currency {
        padding: 4px 16px 4px 7px;
        background-position: right 5px center;
        font-size: 11px;
    }

    .t-nav-actions .t-lang-btn {
        padding: 4px 6px;
        gap: 4px;
        font-size: 11px;
    }

    .t-nav-actions .t-nav-login {
        padding: 5px 8px;
        font-size: 10.5px;
        gap: 4px;
    }

    .t-nav-toggle {
        margin-left: 2px;
        padding: 6px;
    }

    /* 3-column mobile service tiles: prevent French multi-word names from scattering heights */
    html[data-site-lang="fr"] .t-svc-grid {
        gap: 8px;
    }

    html[data-site-lang="fr"] .t-svc-card {
        padding: 14px 6px;
        gap: 8px;
    }

    html[data-site-lang="fr"] .t-svc-name {
        font-size: 9px;
        letter-spacing: 0.01em;
        line-height: 1.25;
        overflow-wrap: break-word;
        word-break: break-word;
        hyphens: auto;
    }

    /* Newsletter input + "S'abonner" button fit cleanly side-by-side or stacked */
    html[data-site-lang="fr"] .t-nl-form input {
        min-width: 0;
        font-size: 13px;
        padding: 11px 12px;
    }

    html[data-site-lang="fr"] .t-nl-form button {
        padding: 11px 14px;
        font-size: 12px;
    }

    /* Trust strip stays compact */
    html[data-site-lang="fr"] .t-trust-inner {
        gap: 10px 16px;
    }

    html[data-site-lang="fr"] .t-trust-item {
        font-size: 9.5px;
        letter-spacing: 0.02em;
    }

    /* Mobile drawer footer buttons ("Créer un compte" / "Connexion") */
    html[data-site-lang="fr"] .t-m-foot-btn {
        padding: 12px 10px;
        font-size: 13px;
    }
}

@media (max-width: 430px) {
    /* Narrow phones (360px - 430px): extra crisp spacing in mobile header & tabs */
    .t-nav-logo img {
        height: 34px;
    }

    .t-nav-actions .t-lang-caret {
        display: none;
    }

    html[data-site-lang="fr"] .t-nav-actions .t-nav-login svg {
        display: none;
    }

    html[data-site-lang="fr"] .t-nav-actions .t-nav-login {
        padding: 5px 7px;
        font-size: 10px;
    }

    /* Stack icon above label on very narrow phones so 4 French tabs never wrap awkwardly */
    html[data-site-lang="fr"] .t-bbar-tab {
        flex-direction: column;
        gap: 3px;
        padding: 8px 2px;
        font-size: 9.5px;
    }

    html[data-site-lang="fr"] .t-nl-form {
        flex-direction: column;
    }

    html[data-site-lang="fr"] .t-nl-form button {
        width: 100%;
    }
}
