/* === Sahel Sahra Translator - Frontend Switcher === */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* === Floating Switcher === */
.sst-switcher {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    position: relative;
    display: inline-block;
    z-index: 9999;
    direction: ltr;
}

.sst-switcher--floating {
    position: fixed;
}

.sst-pos--top_right    { top: 80px; right: 20px; }
.sst-pos--top_left     { top: 80px; left: 20px; }
.sst-pos--bottom_right { bottom: 30px; right: 20px; }
.sst-pos--bottom_left  { bottom: 30px; left: 20px; }

/* Current button */
.sst-switcher__current {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(29, 78, 137, 0.35);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sst-switcher__current:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 78, 137, 0.45);
    background: linear-gradient(135deg, #1e4a72, #3a7ec4);
}

.sst-switcher__current .sst-flag { font-size: 18px; }
.sst-switcher__current .sst-arrow { font-size: 11px; opacity: 0.8; transition: transform 0.2s; }
.sst-switcher.sst-open .sst-arrow { transform: rotate(180deg); }

/* Dropdown */
.sst-switcher__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    list-style: none;
    margin: 0;
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
}

.sst-pos--top_left .sst-switcher__dropdown,
.sst-pos--bottom_left .sst-switcher__dropdown {
    right: auto;
    left: 0;
}

.sst-pos--bottom_right .sst-switcher__dropdown,
.sst-pos--bottom_left .sst-switcher__dropdown {
    top: auto;
    bottom: calc(100% + 8px);
}

.sst-switcher.sst-open .sst-switcher__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown items */
.sst-switcher__item { list-style: none; margin: 0; padding: 0; }

.sst-lang-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
    white-space: nowrap;
}

.sst-lang-link:hover { background: #f0f9ff; color: #1a3a5c; }
.sst-lang-link .sst-flag { font-size: 18px; }
.sst-lang-link .sst-checkmark { margin-right: auto; color: #2d6a9f; font-weight: 700; }

.sst-switcher__item.sst-active .sst-lang-link {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    color: #1a3a5c;
    font-weight: 700;
}

/* Inline style */
.sst-switcher--inline .sst-switcher__current {
    background: transparent;
    color: #374151;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: none;
    padding: 6px 12px;
}
.sst-switcher--inline .sst-switcher__current:hover {
    border-color: #2d6a9f;
    color: #2d6a9f;
    transform: none;
    box-shadow: none;
}

/* Translation loading indicator */
.sst-translating-overlay {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a3a5c, #2d6a9f);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(29,78,137,0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: sst-slide-in 0.3s ease;
}

@keyframes sst-slide-in {
    from { opacity: 0; top: 0px; }
    to   { opacity: 1; top: 16px; }
}

.sst-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: sst-spin 0.8s linear infinite;
}

@keyframes sst-spin { to { transform: rotate(360deg); } }

/* Body class for LTR languages */
.sst-dir-ltr { direction: ltr; }
.sst-dir-ltr .sst-switcher--floating { right: auto; left: 20px; }

/* RTL fix for floating switcher on LTR pages */
body.sst-dir-ltr .sst-pos--top_right { right: auto; left: 20px; }
body.sst-dir-ltr .sst-pos--bottom_right { right: auto; left: 20px; }

/* Responsive */
@media (max-width: 768px) {
    .sst-pos--top_right, .sst-pos--top_left { top: 60px; }
    .sst-switcher__current { padding: 7px 12px; font-size: 13px; }
    .sst-switcher__dropdown { min-width: 140px; }
}
