/*
 * EXCIDA 2026 — Internet TV styles.
 * Extracted from the approved design (New Template/index.html & index_en.html),
 * extended with the language switcher, live badges, archive filter and the
 * secure player chrome. Direction-agnostic via CSS logical properties:
 * the same sheet serves LTR (en) and RTL (fa/ar).
 */

:root {
    --bg-main: #0c0a12;
    --bg-panel: #14111f;
    --bg-card: #1b172a;
    --text-primary: #ffffff;
    --text-muted: #a39eb8;
    --accent-purple: #8b5cf6;
    --accent-purple-dark: #6d28d9;
    --border-color: rgba(139, 92, 246, 0.22);
    --tv-frame: #1e192c;
    --tv-inner: #07050b;
}

[data-theme="light"] {
    --bg-main: #f4f2f8;
    --bg-panel: #ffffff;
    --bg-card: #ece6f6;
    --text-primary: #120d1e;
    --text-muted: #6b6382;
    --accent-purple: #7c3aed;
    --accent-purple-dark: #5b21b6;
    --border-color: rgba(124, 58, 237, 0.25);
    --tv-frame: #2d2442;
    --tv-inner: #110d1c;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: "Vazirmatn", Tahoma, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.container {
    width: min(1240px, calc(100% - 32px));
    margin: 0 auto;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */

header {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-content {
    min-height: 85px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-block: 10px;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    height: 48px;
    width: auto;
    max-width: 150px; /* a wide upload must never crowd out the title */
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0; /* lets the title shrink instead of overflowing */
}

.brand-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-title span {
    color: var(--accent-purple);
}

.brand-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-toggle,
.lang-switcher button {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.theme-toggle:hover,
.lang-switcher button:hover {
    border-color: var(--accent-purple);
}

/* Language switcher sits right beside the theme toggle */
.lang-switcher {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.lang-switcher form { display: inline-flex; }

.lang-switcher button {
    padding: 7px 11px;
    border: none;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    background: transparent;
    color: var(--text-muted);
    letter-spacing: 0.4px;
}

.lang-switcher button.active {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-dark));
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.35);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-dark));
    color: #ffffff;
    padding: 11px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-ghost {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
}

.btn-ghost:hover { border-color: var(--accent-purple); }

/* ------------------------------------------------------------------ */
/* Main / hero                                                         */
/* ------------------------------------------------------------------ */

main {
    padding: 40px 0;
    flex: 1;
}

.hero-section {
    text-align: center;
    margin-bottom: 35px;
}

.congress-badge {
    display: inline-block;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid var(--border-color);
    color: var(--accent-purple);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
}

.hero-section h1 {
    font-size: clamp(26px, 4vw, 42px);
    font-weight: 900;
    margin-bottom: 10px;
}

.hero-section h1 .vs {
    color: var(--accent-purple);
}

.hero-section p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ------------------------------------------------------------------ */
/* Room switcher                                                       */
/* ------------------------------------------------------------------ */

.rooms-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 70px;
}

.room-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 16px;
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.room-btn.active, .room-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(139, 92, 246, 0.05));
    border-color: var(--accent-purple);
    color: var(--text-primary);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.2);
}

.room-btn::before {
    content: "●";
    color: var(--accent-purple);
    font-size: 10px;
}

.room-btn[data-live="1"]::before {
    color: #ef4444;
    animation: live-pulse 1.6s infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(1.25); }
}

/* Mobile-only hall switcher: a neon-glassmorphic <select> standing in for
   the tab list. Hidden by default; revealed below 720px where the tabs
   collapse. Logical inset properties keep it RTL-safe without overrides. */
.rooms-mobile {
    display: none;
}

.rooms-mobile-shell {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.38);
    background: linear-gradient(150deg, rgba(139, 92, 246, 0.16), rgba(20, 17, 31, 0.55));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.18),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.rooms-mobile-shell:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 32px rgba(139, 92, 246, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Active-hall indicator: purple idle, pulsing red when that hall is live.
   Mirrors .room-btn::before so both switchers read identically. */
.rooms-mobile-live {
    position: absolute;
    inset-inline-start: 16px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent-purple);
    pointer-events: none;
    z-index: 1;
}

.rooms-mobile-live[data-live="1"] {
    background: #ef4444;
    animation: live-pulse 1.6s infinite;
}

.rooms-mobile-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.2px;
    padding: 15px 44px; /* symmetric — clears dot and chevron in both dirs */
    cursor: pointer;
    outline: none;
}

.rooms-mobile-select option {
    background: var(--bg-panel);
    color: var(--text-primary);
}

[data-theme="light"] .rooms-mobile-shell {
    background: linear-gradient(150deg, rgba(124, 58, 237, 0.12), rgba(255, 255, 255, 0.65));
}

[data-theme="light"] .rooms-mobile-select option {
    background: #ffffff;
    color: #120d1e;
}

.rooms-mobile-chevron {
    position: absolute;
    inset-inline-end: 15px;
    width: 14px;
    height: 14px;
    pointer-events: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39eb8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* ------------------------------------------------------------------ */
/* Television                                                          */
/* ------------------------------------------------------------------ */

.television-container {
    max-width: 980px;
    margin: 0 auto 50px auto;
    position: relative;
}

.tv-antenna {
    position: absolute;
    top: -45px;
    width: 3px;
    height: 50px;
    background: var(--text-muted);
    z-index: 1;
}
.tv-antenna-left { left: 25%; transform: rotate(-25deg); }
.tv-antenna-right { right: 25%; transform: rotate(25deg); }

.tv-body {
    background: var(--tv-frame);
    border: 16px solid var(--tv-frame);
    border-radius: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.25);
    position: relative;
}

.tv-screen {
    background: var(--tv-inner);
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.stream-placeholder {
    text-align: center;
    padding: 20px;
}

.play-circle {
    width: 72px;
    height: 72px;
    background: var(--accent-purple);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: white;
    font-size: 28px;
    margin: 0 auto 16px auto;
    box-shadow: 0 0 30px var(--accent-purple);
}

.stream-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.stream-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Secure player fills the TV screen */
.tv-screen video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    outline: none;
}

.tv-screen video::-webkit-media-controls-enclosure { display: none; }

.player-status {
    position: absolute;
    inset-inline-start: 14px;
    top: 12px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(7, 5, 11, 0.72);
    border: 1px solid var(--border-color);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
}

.player-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: live-pulse 1.6s infinite;
}

.members-only {
    text-align: center;
    padding: 24px;
    max-width: 420px;
}

.members-only h3 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 8px;
}

.members-only p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

/* Anti-capture shield shown when tampering is suspected */
.shield-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: none;
    place-items: center;
    background: rgba(7, 5, 11, 0.96);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    padding: 20px;
}

.tv-screen.protected .shield-overlay { display: grid; }

.tv-bottom-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px 4px 20px;
}

.tv-brand-label {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.tv-knobs {
    display: flex;
    gap: 12px;
    align-items: center;
}

.knob {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-main);
    border: 2px solid var(--text-muted);
}

.tv-stand {
    display: flex;
    justify-content: space-around;
    width: 180px;
    margin: 0 auto;
}

.tv-stand span {
    width: 40px;
    height: 12px;
    background: var(--tv-frame);
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* ------------------------------------------------------------------ */
/* Archive                                                             */
/* ------------------------------------------------------------------ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 800;
}

.archive-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.archive-filter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 9px 34px 9px 14px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39eb8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 14px;
    background-position: right 12px center;
}

[dir="rtl"] .archive-filter {
    padding: 9px 14px 9px 34px;
    background-position: left 12px center;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.archive-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.archive-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-purple);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
}

.archive-thumb {
    height: 140px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-main));
    display: grid;
    place-items: center;
    font-size: 28px;
    color: var(--accent-purple);
    position: relative;
}

.archive-duration {
    position: absolute;
    bottom: 8px;
    inset-inline-end: 8px;
    background: rgba(7, 5, 11, 0.8);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    direction: ltr;
}

.archive-hall-chip {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    background: rgba(139, 92, 246, 0.85);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 8px;
}

.archive-body {
    padding: 16px;
}

.archive-body h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.archive-body p {
    font-size: 12px;
    color: var(--text-muted);
}

.archive-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px 0;
    display: none;
}

/* ------------------------------------------------------------------ */
/* Admin navigation strip                                              */
/* ------------------------------------------------------------------ */

.admin-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 8px;
    margin-bottom: 24px;
}

.admin-nav-link {
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
}

.admin-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.admin-nav-link.active {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-dark));
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.35);
}

.admin-nav-spacer { flex: 1; }

/* Logout control in the panel strip: a form button wearing the nav-link skin */
.admin-nav-form { display: inline-flex; }

.admin-nav-form button.admin-nav-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.admin-body { min-height: 50vh; }

/* ------------------------------------------------------------------ */
/* Admin dashboard stat cards                                          */
/* ------------------------------------------------------------------ */

.stat-card .stat-value {
    font-size: 34px;
    font-weight: 900;
    color: var(--accent-purple);
    margin-bottom: 6px;
    direction: ltr;
}

.stat-card h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------ */
/* Admin tables & forms                                                */
/* ------------------------------------------------------------------ */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    font-size: 13.5px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: start;
    border-block-end: 1px solid var(--border-color);
}

.admin-table thead th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: var(--bg-card);
}

.admin-table tbody tr:hover { background: rgba(139, 92, 246, 0.06); }

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.table-actions form { display: inline; }

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 8px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }

.chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg-card);
    color: var(--text-muted);
}

.chip-live {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    animation: live-pulse 1.6s infinite;
}

.flash {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 18px;
}

.flash ul { margin-inline-start: 18px; font-weight: 400; }

.flash-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.flash-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.admin-form { max-width: 760px; }

.admin-form em,
.auth-field em {
    display: block;
    color: #f87171;
    font-style: normal;
    font-size: 12px;
    margin-top: 4px;
}

.admin-form .auth-field { margin-bottom: 16px; }

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.admin-checks {
    display: flex;
    gap: 22px;
    margin-bottom: 20px;
    font-size: 13.5px;
}

.admin-checks label {
    display: flex;
    gap: 8px;
    align-items: center;
    cursor: pointer;
}

.admin-locale {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.admin-locale legend {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-purple);
    padding-inline: 6px;
}

/* Shown server-side when no recordings exist, or by the hall filter
   when a selection matches zero cards. */
.archive-empty.on {
    display: block;
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

footer {
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Auth card (login)                                                   */
/* ------------------------------------------------------------------ */

.auth-wrap {
    max-width: 400px;
    margin: 48px auto;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 32px;
}

.auth-wrap h1 {
    font-size: 19px;
    font-weight: 900;
    margin-bottom: 4px;
}

.auth-wrap .auth-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 22px;
}

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 14px;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* ------------------------------------------------------------------ */
/* Admin form controls                                                 */
/*                                                                     */
/* One dark-glass skin shared by EVERY control family (url/number      */
/* inputs, selects, textareas included — otherwise browsers paint      */
/* native white boxes). Scoped to .admin-form so the login card       */
/* keeps its exact previous look.                                      */
/* ------------------------------------------------------------------ */

.admin-form .auth-field input:not([type="checkbox"]):not([type="radio"]),
.admin-form .auth-field select,
.admin-form .auth-field textarea {
    width: 100%;
    margin-bottom: 0;
    padding: 11px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    /* Translucent neon tint over the panel = glassmorphism */
    background-color: rgba(139, 92, 246, 0.07);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-form .auth-field input:focus,
.admin-form .auth-field select:focus,
.admin-form .auth-field textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18),
                0 0 18px rgba(139, 92, 246, 0.25);
}

.admin-form .auth-field ::placeholder {
    color: var(--text-muted);
    opacity: 0.65;
}

.admin-form .auth-field textarea {
    resize: vertical;
    min-height: 76px;
    line-height: 1.55;
}

/* Selects: drop the native chrome, draw our own direction-aware chevron */
.admin-form .auth-field select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-inline-end: 38px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39eb8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 15px;
    background-position: right 13px center;
}

[dir="rtl"] .admin-form .auth-field select {
    padding-inline-end: 14px;
    padding-inline-start: 38px;
    background-position: left 13px center;
}

.admin-form .auth-field select option {
    background: var(--bg-panel);
    color: var(--text-primary);
}

[data-theme="light"] .admin-form .auth-field select option {
    background: #ffffff;
    color: #120d1e;
}

/* Helper text directly beneath a control */
.admin-form .field-hint {
    display: block;
    margin-top: 6px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-muted);
}

.admin-form .field-hint + em {
    margin-top: 3px;
}

/* Checkboxes: neon accent, comfortable hit target */
.admin-checks input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--accent-purple);
    cursor: pointer;
    grid-row: 1;
}

/* Grid so the helper text wraps UNDER the caption, not beside it */
.admin-checks label {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 9px;
    row-gap: 2px;
    cursor: pointer;
}

.admin-checks .field-hint {
    grid-column: 2;
    margin-top: 0;
    font-size: 11px;
}

[data-theme="light"] .admin-form .auth-field input:not([type="checkbox"]):not([type="radio"]),
[data-theme="light"] .admin-form .auth-field select,
[data-theme="light"] .admin-form .auth-field textarea {
    background-color: rgba(124, 58, 237, 0.06);
}

.auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    margin-bottom: 18px;
    color: var(--text-muted);
}

.auth-error {
    color: #f87171;
    font-size: 12.5px;
    margin-bottom: 12px;
}

/* ------------------------------------------------------------------ */
/* OTP login (passwordless)                                            */
/*                                                                     */
/* Step card over the shared layout; inputs reuse the admin form's     */
/* neon-glass skin so the whole platform feels like one system.        */
/* ------------------------------------------------------------------ */

.auth-otp {
    background-color: rgba(20, 17, 31, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 0 44px rgba(139, 92, 246, 0.14);
    border-color: var(--border-color);
}

[data-theme="light"] .auth-otp {
    background-color: rgba(255, 255, 255, 0.82);
}

.auth-flash {
    font-size: 12.5px;
    color: var(--accent-purple);
    margin-bottom: 12px;
}

/* SMS / e-mail channel switch above the login form */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 18px;
}

.auth-tab {
    text-align: center;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(139, 92, 246, 0.05);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-tab:hover { color: var(--text-primary); }

.auth-tab.active {
    color: var(--text-primary);
    border-color: var(--accent-purple);
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.22);
}

.auth-meta {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.auth-meta a {
    display: inline-block;
    margin-top: 2px;
    color: var(--accent-purple);
    text-decoration: none;
    font-size: 12.5px;
}

.auth-meta a:hover { text-decoration: underline; }

/* Glass skin for the login controls (text + tel inputs) */
.auth-step .auth-field input[type="text"],
.auth-step .auth-field input[type="tel"],
.auth-step .auth-field input[type="password"] {
    background-color: rgba(139, 92, 246, 0.07);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-step .auth-field input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18),
                0 0 18px rgba(139, 92, 246, 0.25);
}

.auth-step .auth-field ::placeholder {
    color: var(--text-muted);
    opacity: 0.65;
}

/* The five digits get room to breathe */
.otp-code-input {
    letter-spacing: 0.45em;
    text-align: center;
    font-size: 19px !important;
    font-weight: 700;
}

[dir="rtl"] .otp-code-input { text-align: center; }

/* First/last name pair for first-time numbers */
.auth-names {
    border: none;
    padding: 0;
    margin: 0 0 14px;
}

.auth-names legend {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0;
    margin-bottom: 10px;
}

.auth-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.auth-resend-form { margin-top: 16px; }

.auth-resend {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-ghost[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.resend-timer {
    font-size: 12.5px;
    color: var(--text-muted);
}

@media (max-width: 560px) {
    .auth-wrap.auth-otp {
        padding: 24px 18px;
        margin-inline: 12px;
    }

    .otp-code-input { letter-spacing: 0.3em; }

    .auth-fields-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {
    .rooms-nav, .archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    /* Mobile header becomes a tidy two-row bar: brand on top, compact
       controls beneath. Centering + wrap keep every button clear of the
       others even with three locales and long translated labels. */
    .header-content {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        min-height: 0;
        padding-block: 12px;
    }

    .brand-box {
        max-width: 100%;
        justify-content: center;
    }

    .nav-actions {
        width: 100%;
        justify-content: center;
        gap: 8px;
        row-gap: 8px;
    }

    .theme-toggle,
    .btn-primary,
    .btn-ghost {
        padding: 8px 13px;
        font-size: 13px;
    }

    .lang-switcher button { padding: 6px 9px; font-size: 11px; }

    /* Swap the tab list for the neon-glass dropdown. The buttons stay in
       the DOM as the switcher's source of truth; app.js clicks them. */
    .rooms-nav { display: none; }
    .rooms-mobile { display: block; margin-bottom: 70px; }
}

@media (max-width: 560px) {
    .archive-grid {
        grid-template-columns: 1fr;
    }
    .tv-antenna { display: none; }
}
