/* ============================================================
   Til almashtirgich (language switcher) - shared widget
   Sits to the left of the Ko'rinish (appearance) widget, same
   visual language: pill trigger + dropdown panel.
   ============================================================ */

.kpi-lang-widget {
    position: fixed;
    top: 16px;
    right: 180px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.kpi-lang-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 44px;
    padding: 0 14px;
    background: #ffffff;
    color: #004FAE;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    transition: background 0.2s, border-color 0.2s;
}

.kpi-lang-trigger:hover {
    border-color: #004FAE;
    background: #f0f6ff;
}

body.dark-mode .kpi-lang-trigger {
    background: #1f2937;
    color: #93c5fd;
    border-color: #374151;
}

body.dark-mode .kpi-lang-trigger:hover {
    background: #25303f;
}

.kpi-lang-trigger .kpi-chev {
    font-size: 11px;
    transition: transform 0.15s ease;
}

.kpi-lang-trigger[aria-expanded="true"] .kpi-chev {
    transform: rotate(180deg);
}

/* hidden atributi display:flex dan ustun turishi kerak — aks holda panel doim ochiq qoladi */
.kpi-lang-panel[hidden] {
    display: none;
}

.kpi-lang-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 170px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.2);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.dark-mode .kpi-lang-panel {
    background: #1f2937;
    border-color: #374151;
}

.kpi-lang-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 10px;
    border: none;
    background: transparent;
    color: #1f2937;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.kpi-lang-option:hover {
    background: #f0f6ff;
}

.kpi-lang-option.active {
    background: #004FAE;
    color: #ffffff;
    font-weight: 700;
}

body.dark-mode .kpi-lang-option {
    color: #e5e7eb;
}

body.dark-mode .kpi-lang-option:hover {
    background: #25303f;
}

body.dark-mode .kpi-lang-option.active {
    background: #3b82f6;
    color: #ffffff;
}

@media (max-width: 640px) {
    .kpi-lang-widget {
        top: 64px;
        right: 12px;
    }

    .kpi-lang-trigger {
        padding: 0 10px;
    }

    .kpi-lang-trigger .kpi-lang-label {
        display: none;
    }

    .kpi-lang-panel {
        width: 150px;
    }
}
