/* =========================
   LANGUAGE SWITCHER
   Batis Travel - Translation System
   Path: /translator/translator.css
   ========================= */

.lang-switcher {
    position: fixed;
    bottom: 100px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
    max-height: 52px;
    transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.lang-switcher.open {
    max-height: 320px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.lang-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1d1d1f);
    font-family: inherit;
    transition: background 0.2s;
    white-space: nowrap;
}

.lang-switcher-toggle:hover {
    background: #f8f9fa;
}

.lang-switcher-toggle .lang-flag {
    font-size: 20px;
}

.lang-switcher-toggle .lang-arrow {
    margin-left: auto;
    transition: transform 0.3s;
    opacity: 0.5;
}

.lang-switcher.open .lang-switcher-toggle .lang-arrow {
    transform: rotate(180deg);
}

.lang-options {
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(0,0,0,0.06);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #1d1d1f);
    font-family: inherit;
    transition: background 0.2s;
    white-space: nowrap;
    text-align: left;
}

.lang-option:hover {
    background: #f0f7ff;
}

.lang-option.active {
    background: #e8f4fd;
    color: var(--ios-blue, #007aff);
    font-weight: 600;
}

.lang-option .lang-flag {
    font-size: 18px;
}

.lang-translating-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    z-index: 99999;
    display: none;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.lang-translating-indicator.show {
    display: flex;
    animation: langFadeSlideDown 0.3s ease;
}

@keyframes langFadeSlideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.lang-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: langSpin 0.8s linear infinite;
}

@keyframes langSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =========================
   RTL SUPPORT
   ========================= */
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .back-button svg {
    transform: scaleX(-1);
}

html[dir="rtl"] .brand-logo {
    left: auto !important;
    right: 30px !important;
}

html[dir="rtl"] .brand-holding {
    right: auto !important;
    left: 30px !important;
}

html[dir="rtl"] .sidebar-ad-left {
    left: auto;
    right: 30px;
}

html[dir="rtl"] .sidebar-ad-right {
    right: auto;
    left: 30px;
}

html[dir="rtl"] .lang-switcher {
    left: auto;
    right: 20px;
}

html[dir="rtl"] .lang-option {
    text-align: right;
}

html[dir="rtl"] .sidebar-ad::before {
    right: auto;
    left: 8px;
}

html[dir="rtl"] .ad-card-button svg,
html[dir="rtl"] .page-card .card-button svg {
    transform: scaleX(-1);
}

html[dir="rtl"] .search-input {
    text-align: right;
}

html[dir="rtl"] .breadcrumb {
    direction: rtl;
}

html[dir="rtl"] .chat-input,
html[dir="rtl"] .chat-text-input {
    text-align: right;
}

html[dir="rtl"] .form-input,
html[dir="rtl"] .form-textarea {
    text-align: right;
}

html[dir="rtl"] .feature-item {
    flex-direction: row-reverse;
    text-align: right;
}

html[dir="rtl"] .quick-access-buttons {
    direction: rtl;
}

/* =========================
   RTL RESPONSIVE
   ========================= */
@media (max-width: 768px) {
    .lang-switcher {
        bottom: 80px;
        left: 12px;
    }

    html[dir="rtl"] .lang-switcher {
        left: auto;
        right: 12px;
    }

    html[dir="rtl"] .brand-logo {
        right: 15px !important;
        left: auto !important;
    }

    html[dir="rtl"] .brand-holding {
        left: 15px !important;
        right: auto !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    html[dir="rtl"] .sidebar-ad-left {
        left: auto;
        right: 10px;
    }

    html[dir="rtl"] .sidebar-ad-right {
        right: auto;
        left: 10px;
    }
}