/* ============================================
   TranslateFlow AI - Sélecteur de langue
   ============================================ */

.ct-switcher {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Google legacy widget cleanup: if a theme/plugin injects the old Google bar,
   keep the page clean. TranslateFlow AI itself uses the free endpoint, not the bar. */
.goog-te-banner-frame,
.skiptranslate iframe,
body > .skiptranslate {
    display: none !important;
}

html.translated-ltr body,
html.translated-rtl body {
    top: 0 !important;
}

/* --- Variant flags --- */
.ct-switcher--flags .ct-switcher__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.ct-switcher--flags .ct-switcher__item {
    margin: 0;
    padding: 0;
}

.ct-switcher--flags a,
.ct-language-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ct-switcher--flags a:hover,
.ct-language-link:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.ct-switcher a:focus-visible,
.ct-switcher button:focus-visible,
.ct-language-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 3px;
}

.ct-switcher--flags .ct-current a {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    font-weight: 600;
}

.ct-switcher--names .ct-flag,
.ct-switcher--codes .ct-flag {
    display: none;
}

.ct-flag {
    font-size: 18px;
    line-height: 1;
}

.ct-flag-img {
    display: inline-block;
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 auto;
}

.ct-name {
    font-size: 13px;
}

/* --- Variant dropdown --- */
.ct-switcher--dropdown {
    position: relative;
    display: inline-block;
}

.ct-switcher__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: all 0.18s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ct-switcher__toggle:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ct-switcher__toggle:active {
    transform: scale(0.98);
}

.ct-switcher--nice_dropdown .ct-switcher__toggle,
.ct-switcher--popup .ct-switcher__toggle {
    min-width: 150px;
    justify-content: space-between;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.ct-switcher--globe .ct-switcher__toggle {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
}

.ct-switcher--globe .ct-switcher__toggle .ct-name,
.ct-switcher--globe .ct-switcher__toggle .ct-chevron {
    display: none;
}

.ct-chevron {
    font-size: 10px;
    opacity: 0.5;
    transition: transform 0.2s ease;
    margin-left: 2px;
}

.ct-switcher--dropdown.is-open .ct-chevron {
    transform: rotate(180deg);
}

/* ---- Dropdown menu : opens DOWNWARD by default ---- */
.ct-switcher__menu {
    position: absolute;
    top: calc(100% + 6px);
    bottom: auto;
    right: 0;
    min-width: 180px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.13), 0 2px 6px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 9999;
    /* Prevent overflow clipping */
    overflow: visible;
}

/* ---- Opens UPWARD (static class or JS-injected) ---- */
.ct-switcher--up .ct-switcher__menu,
.ct-switcher--dropdown[data-ct-dir="up"] .ct-switcher__menu {
    top: auto;
    bottom: calc(100% + 6px);
    transform: translateY(6px) scale(0.97);
    transform-origin: bottom right;
}

/* ---- Opened state ---- */
.ct-switcher--dropdown.is-open .ct-switcher__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ct-switcher__menu li {
    margin: 0;
    padding: 0;
}

.ct-switcher__menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    text-decoration: none;
    color: #1e293b;
    transition: background 0.12s ease;
    font-size: 14px;
    white-space: nowrap;
}

.ct-switcher__menu a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ct-switcher--popup .ct-switcher__menu {
    min-width: 240px;
    max-height: min(420px, 70vh);
    overflow-y: auto;
}

[dir="rtl"] .ct-switcher__menu,
.ct-rtl .ct-switcher__menu {
    right: auto;
    left: 0;
    text-align: right;
}

/* ---- Floating widget ----
   NOTE: do NOT use filter: drop-shadow here — it creates a new stacking
   context that breaks z-index on iOS Safari and many Android browsers.
   Use box-shadow on the toggle button instead.
*/
.ct-floating {
    position: fixed;
    z-index: 99999;
}

.ct-floating--top-left    { top: 20px;    left: 20px;  }
.ct-floating--top-right   { top: 20px;    right: 20px; }
.ct-floating--bottom-left { bottom: 20px; left: 20px;  }
.ct-floating--bottom-right{ bottom: 20px; right: 20px; }

/*
 * When the floater is at the bottom of the screen the menu MUST open upward
 * (there is no space below). Override any admin setting forcefully.
 */
.ct-floating--bottom-left  .ct-switcher__menu,
.ct-floating--bottom-right .ct-switcher__menu {
    top: auto !important;
    bottom: calc(100% + 6px) !important;
    transform: translateY(6px) scale(0.97) !important;
    transform-origin: bottom right;
}

.ct-floating--bottom-left .ct-switcher__menu {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.ct-floating--bottom-left  .ct-switcher--dropdown.is-open .ct-switcher__menu,
.ct-floating--bottom-right .ct-switcher--dropdown.is-open .ct-switcher__menu {
    transform: translateY(0) scale(1) !important;
}

/*
 * When the floater is at the top-left, the menu aligns left.
 */
.ct-floating--top-left .ct-switcher__menu {
    right: auto;
    left: 0;
    transform-origin: top left;
}

.ct-menu-item .ct-switcher {
    display: inline-flex;
    vertical-align: middle;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {

    .ct-switcher--flags .ct-switcher__list {
        flex-wrap: wrap;
    }

    /* Tighter corner placement */
    .ct-floating--top-left    { top: 12px;    left: 12px;  right: auto;  }
    .ct-floating--top-right   { top: 12px;    right: 12px; left: auto;   }
    .ct-floating--bottom-left { bottom: 12px; left: 12px;  right: auto;  }
    .ct-floating--bottom-right{ bottom: 12px; right: 12px; left: auto;   }

    .ct-switcher__toggle {
        padding: 7px 11px;
        font-size: 13px;
    }

    /* Keep menu on screen: max height + scroll */
    .ct-switcher__menu {
        max-width: min(240px, calc(100vw - 28px));
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /*
     * On mobile, top-positioned floaters should ALWAYS open downward;
     * bottom-positioned ones already open upward (rule above).
     */
    .ct-floating--top-left  .ct-switcher__menu,
    .ct-floating--top-right .ct-switcher__menu {
        top: calc(100% + 6px) !important;
        bottom: auto !important;
        transform: translateY(-6px) scale(0.97) !important;
        transform-origin: top right;
    }

    .ct-floating--top-left .ct-switcher__menu {
        transform-origin: top left;
    }

    .ct-floating--top-left  .ct-switcher--dropdown.is-open .ct-switcher__menu,
    .ct-floating--top-right .ct-switcher--dropdown.is-open .ct-switcher__menu {
        transform: translateY(0) scale(1) !important;
    }
}
