/* =====================================================================
   TenRusl-Markdown-MD — language.css
   Khusus UI bilingual / i18n
   ===================================================================== */

.lang-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.lang-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    min-width: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)), var(--panel);
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease,
        box-shadow 0.16s ease;
}

.lang-toggle:hover {
    color: var(--heading);
    border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(31, 111, 235, 0.16);
}

.lang-toggle:active {
    transform: translateY(1px);
}

.lang-current {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.lang-badge,
.badge-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 4px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    border: 1px solid var(--border-soft);
    color: var(--heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    text-transform: uppercase;
}

#btnUiLang,
#btnUiLangSites {
    position: relative;
    gap: 8px;
}

#btnUiLang .label,
#btnUiLangSites .label {
    white-space: nowrap;
}

#btnUiLang .badge-mini,
#btnUiLangSites .badge-mini {
    margin-left: 2px;
}

.lang-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: min(360px, calc(100vw - 24px));
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 70;
    backdrop-filter: blur(12px);
}

.lang-popover[hidden] {
    display: none !important;
}

.lang-popover-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.lang-popover-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--heading);
}

.lang-popover-body {
    padding: 12px;
}

.lang-search {
    width: 100%;
    min-height: 40px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.lang-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-ring);
}

.lang-list {
    display: grid;
    gap: 8px;
}

.lang-item {
    appearance: none;
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: transform 0.12s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.lang-item:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.lang-item:active {
    transform: translateY(1px);
}

.lang-item[data-active="true"],
.lang-item.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-ring) inset;
}

.lang-item .lang-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 4px 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    color: var(--heading);
    text-transform: uppercase;
}

.lang-item .lang-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--heading);
    line-height: 1.3;
}

.lang-item .lang-desc {
    display: block;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.3;
}

.translation-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.translation-inline .lang-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface-soft);
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.i18n-muted,
[data-i18n-muted="true"] {
    color: var(--muted);
}

[dir="rtl"] .lang-popover {
    right: auto;
    left: 0;
}

@media (max-width: 980px) {
    #btnUiLang,
    #btnUiLangSites {
        min-width: 38px;
        padding-inline: 10px;
    }
}

@media (max-width: 860px) {
    .lang-popover {
        position: fixed;
        inset: auto 12px 12px 12px;
        width: auto;
        max-height: calc(100dvh - 24px);
        overflow: auto;
    }
}
