/* TeleLive — theme + language (menu / drawer) */

.tl-nav-controls {
    display: none !important;
}

/* Legacy markup (old deploy): force-hide always-open list + text labels */
.tl-menu-locale__label,
.tl-menu-locale__lang-head,
.tl-menu-locale__lang-list,
.tl-menu-locale__theme-row .tl-menu-locale__label {
    display: none !important;
}

.tl-menu-locale__lang-list {
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* ── Menu locale block (user dropdown + mob drawer) ── */
.tl-menu-locale {
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin: 4px 0;
}

.tl-menu-locale__row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: nowrap;
}

/* Icon-only theme toggle in menu (no "Toggle color theme" label) */
.tl-theme-pill--icon-only {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px;
    padding: 0 !important;
    flex-shrink: 0;
    justify-content: center;
}

.tl-theme-pill--icon-only .tl-theme-pill__label {
    display: none !important;
}

.tl-theme-pill--icon-only .tl-theme-pill__knob {
    position: static !important;
    width: 30px !important;
    height: 30px !important;
    inset: auto !important;
    transform: none !important;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.tl-theme-pill--icon-only[data-active="light"] .tl-theme-pill__knob,
.tl-theme-pill--icon-only[data-active="dark"] .tl-theme-pill__knob,
.tl-theme-pill--icon-only[data-active="auto"] .tl-theme-pill__knob {
    inset-inline-start: auto !important;
}

.tl-theme-pill--icon-only .tl-theme-pill__icon {
    width: 16px;
    height: 16px;
}

.tl-menu-lang-picker {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.tl-lang-trigger--menu {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    font-size: 0.7rem;
    justify-content: flex-start;
    gap: 8px;
}

/* Language list: hidden until picker open (fixes drawer showing all langs) */
.tl-menu-locale .tl-lang-menu,
.tl-menu-locale .tl-lang-menu--menu {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.tl-menu-locale .tl-lang-picker.is-open .tl-lang-menu,
.tl-menu-locale .tl-lang-picker.is-open .tl-lang-menu--menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.tl-menu-locale--drawer {
    margin: 6px 0;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: transparent;
}

.tl-menu-locale--drawer .tl-menu-lang-picker {
    flex: 1 1 0;
}

.tl-menu-locale--drawer .tl-lang-menu--menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    inset-inline: 0;
    min-width: 0;
    max-height: min(45vh, 280px);
    z-index: 1105;
}

.tl-menu-locale--dropdown .tl-lang-menu--menu {
    top: auto;
    bottom: calc(100% + 6px);
    inset-inline-end: 0;
    inset-inline-start: auto;
    min-width: 200px;
    transform: translateY(4px) scale(0.98);
}

.tl-menu-locale--dropdown .tl-lang-picker.is-open .tl-lang-menu--menu {
    transform: translateY(0) scale(1);
}

.user-dropdown:has(.tl-menu-locale) {
    width: min(92vw, 280px);
    max-height: min(88vh, 640px);
    overflow-x: hidden;
    overflow-y: auto;
}

.user-dropdown .tl-menu-locale {
    margin-inline: 0;
}

/* ── Base theme pill (legacy / other pages) ── */
.tl-theme-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 148px;
    height: 44px;
    padding: 0 6px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    transition: background 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.tl-theme-pill[data-active="light"] {
    background: #e8e8ec;
}

.tl-theme-pill[data-active="dark"] {
    background: #0e0e10;
}

.tl-theme-pill[data-active="auto"] {
    background: linear-gradient(90deg, #e8e8ec 0%, #e8e8ec 50%, #0e0e10 50%, #0e0e10 100%);
}

.tl-theme-pill__label {
    flex: 1;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    z-index: 1;
    transition: color 0.4s ease, opacity 0.35s ease;
    pointer-events: none;
}

.tl-theme-pill[data-active="light"] .tl-theme-pill__label {
    color: #0e0e10;
    text-align: start;
    padding-inline-start: 12px;
}

.tl-theme-pill[data-active="dark"] .tl-theme-pill__label {
    color: #fff;
    text-align: end;
    padding-inline-end: 12px;
}

.tl-theme-pill[data-active="auto"] .tl-theme-pill__label {
    color: #0e0e10;
    text-align: center;
    font-size: 0.58rem;
}

.tl-theme-pill__knob {
    position: absolute;
    top: 5px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: inset-inline-start 0.42s cubic-bezier(0.22, 1, 0.36, 1), transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.tl-theme-pill[data-active="light"] .tl-theme-pill__knob {
    inset-inline-start: calc(100% - 39px);
}

.tl-theme-pill[data-active="dark"] .tl-theme-pill__knob {
    inset-inline-start: 5px;
}

.tl-theme-pill[data-active="auto"] .tl-theme-pill__knob {
    inset-inline-start: calc(50% - 17px);
}

.tl-theme-pill__icon {
    width: 18px;
    height: 18px;
    color: #0e0e10;
}

.tl-theme-pill__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Language picker (shared) ── */
.tl-lang-picker {
    position: relative;
    flex-shrink: 0;
}

.tl-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-elev-1);
    color: var(--text);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.tl-lang-trigger:hover {
    background: var(--bg-elev-2);
    border-color: var(--brand-soft);
}

.tl-lang-trigger[aria-expanded="true"] {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(30, 86, 245, 0.2);
}

.tl-lang-trigger__flag {
    width: 22px;
    height: 15px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.tl-lang-trigger__flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tl-lang-trigger__chev {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    margin-inline-start: auto;
}

.tl-lang-picker.is-open .tl-lang-trigger__chev {
    transform: rotate(180deg);
}

.tl-lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 200px;
    max-height: min(70vh, 360px);
    overflow-y: auto;
    background: var(--bg-elev-1);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
    z-index: 500;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}

.tl-lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 16px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: start;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
    box-sizing: border-box;
}

.tl-lang-option:hover {
    background: var(--bg-elev-2);
}

.tl-lang-option.is-active {
    background: rgba(30, 86, 245, 0.1);
}

.tl-lang-option__flag {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.tl-lang-option__flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tl-lang-option__check {
    margin-inline-start: auto;
    color: #22c55e;
    font-size: 0.85rem;
    opacity: 0;
}

.tl-lang-option.is-active .tl-lang-option__check {
    opacity: 1;
}

@media (max-width: 768px) {
    .tl-nav-controls {
        display: none !important;
    }
}
