/* =========================================================================
   WT AR/EN Translator — language switcher
   The switcher is always LTR so it never flips position when the page is
   viewed in Arabic. Design: compact pill, soft shadow, monospace language
   codes for easy scanning, flag image as the visual anchor.
   ========================================================================= */

.wtae-switcher {
    /* Colors are exposed as CSS custom properties so the admin can override
       them from Settings → AR/EN Translator without editing CSS. Inline styles
       emitted by the plugin set these on the .wtae-switcher element; otherwise
       the fallbacks below are used. */
    --wtae-bg: rgba(255, 255, 255, 0.96);
    --wtae-text: #4b4b4b;
    --wtae-active-bg: #111;
    --wtae-active-fg: #fff;
    --wtae-hover-bg: #f3f4f6;

    display: inline-flex;
    align-items: stretch;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    line-height: 1;
    direction: ltr;
    unicode-bidi: isolate;
    background: var(--wtae-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    padding: 4px;
    box-shadow: 0 6px 22px -8px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.04);
    backdrop-filter: saturate(1.15) blur(6px);
    -webkit-backdrop-filter: saturate(1.15) blur(6px);
}

.wtae-switcher .wtae-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--wtae-text);
    text-decoration: none;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
    cursor: pointer;
}

.wtae-switcher .wtae-lang:hover,
.wtae-switcher .wtae-lang:focus-visible {
    background: var(--wtae-hover-bg);
    color: var(--wtae-active-bg);
    outline: none;
}

.wtae-switcher .wtae-lang.is-active {
    background: var(--wtae-active-bg);
    color: var(--wtae-active-fg);
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.wtae-switcher .wtae-lang img {
    display: block;
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    flex: none;
}

.wtae-switcher .wtae-code {
    font-size: 12px;
    font-weight: 700;
}

.wtae-switcher .wtae-divider {
    width: 1px;
    margin: 4px 2px;
    background: rgba(0, 0, 0, 0.08);
    align-self: stretch;
}

/* Floating placement — always bottom-right, regardless of page direction. */
.wtae-switcher.wtae-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    z-index: 2147483000; /* above most themes' sticky bars, below WP admin bar toasts */
    transform: translateZ(0);
}

.wtae-switcher.wtae-floating:hover {
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.24), 0 2px 4px rgba(0, 0, 0, 0.06);
}

/* Entrance animation */
@keyframes wtae-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wtae-switcher.wtae-floating {
    animation: wtae-fade-in 260ms ease-out both;
}

/* Buttons style: larger, squared-off pills, used when [wtae_switcher style="buttons"]. */
.wtae-switcher.wtae-style-buttons {
    padding: 6px;
    border-radius: 14px;
}

.wtae-switcher.wtae-style-buttons .wtae-lang {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 10px;
}

/* Dark-mode friendliness: update the color variables instead of hard-coding
   properties, so admin-picked colors (which also flow through these variables)
   remain the source of truth and aren't clobbered here. */
@media (prefers-color-scheme: dark) {
    .wtae-switcher {
        --wtae-bg: rgba(22, 22, 24, 0.9);
        --wtae-text: #d0d0d0;
        --wtae-active-bg: #fff;
        --wtae-active-fg: #111;
        --wtae-hover-bg: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.6);
    }
    .wtae-switcher .wtae-divider {
        background: rgba(255, 255, 255, 0.12);
    }
}

/* Responsive: shrink on small screens so it doesn't crowd mobile UIs. */
@media (max-width: 480px) {
    .wtae-switcher.wtae-floating {
        bottom: 16px;
        right: 16px;
        font-size: 12px;
    }
    .wtae-switcher .wtae-lang {
        padding: 5px 10px;
    }
    .wtae-switcher .wtae-lang img {
        width: 18px;
        height: 13px;
    }
}
