/* Оформление страниц входа / регистрации / модерации.
   Единый стиль со страницей чата (Telegram-like), но без DOS-обёрток основного сайта.
   Палитра и шрифт совпадают с chat_app.css. Тема переключается атрибутом data-theme на <html>. */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body.chat-auth-body {
    --tg-bg:        #0e1621;
    --tg-panel:     #17212b;
    --tg-panel-2:   #212c38;
    --tg-hover:     #202b36;
    --tg-active:    #2b5278;
    --tg-text:      #e9edf0;
    --tg-muted:     #8a97a5;
    --tg-accent:    #6ab7d8;
    --tg-divider:   #0b131b;
    --tg-ring:      #4fb0d6;
    --tg-btn-fg:    #08131d;

    background: var(--tg-bg);
    color: var(--tg-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PT Sans", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

html[data-theme="light"] body.chat-auth-body {
    --tg-bg:        #d7e0ea;
    --tg-panel:     #ffffff;
    --tg-panel-2:   #f1f3f5;
    --tg-hover:     #eef1f4;
    --tg-active:    #2ca5e0;
    --tg-text:      #131a22;
    --tg-muted:     #70757b;
    --tg-accent:    #2a6db5;
    --tg-divider:   #e4e6e9;
    --tg-ring:      #6fb8e6;
    --tg-btn-fg:    #ffffff;
}

/* ---------- Верхняя панель ---------- */
.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--tg-panel);
    border-bottom: 1px solid var(--tg-divider);
}
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--tg-text);
    font-weight: 700;
    letter-spacing: .5px;
    font-size: 18px;
}
.auth-brand .auth-logo {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    background: var(--tg-active);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}
.auth-topbar-right { display: flex; align-items: center; gap: 14px; }
.auth-topbar-right a {
    color: var(--tg-accent);
    text-decoration: none;
    font-size: .92rem;
}
.auth-topbar-right a:hover { text-decoration: underline; }

.auth-theme-toggle {
    width: 34px; height: 34px;
    border: none; border-radius: 50%;
    background: var(--tg-panel-2);
    color: var(--tg-text);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: background .15s;
}
.auth-theme-toggle:hover { background: var(--tg-hover); }
.auth-theme-toggle::before { content: "\263E"; }           /* луна — тёмная тема */
html[data-theme="light"] .auth-theme-toggle::before { content: "\2600"; } /* солнце — светлая */

/* ---------- Центр ---------- */
.auth-main {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--tg-panel);
    border: 1px solid var(--tg-divider);
    border-radius: 16px;
    padding: 30px 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .28);
}
.auth-card.auth-wide { max-width: 960px; }

.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; }
.auth-head p  { margin: 0; color: var(--tg-muted); font-size: .92rem; }

/* ---------- Поля формы ---------- */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > label {
    font-size: .82rem;
    color: var(--tg-muted);
    font-weight: 600;
    padding-left: 2px;
}
.auth-field input {
    width: 100%;
    background: var(--tg-panel-2);
    color: var(--tg-text);
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 12px 14px;
    font: inherit;
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-field input::placeholder { color: var(--tg-muted); opacity: .8; }
.auth-field input:focus {
    outline: none;
    border-color: var(--tg-ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tg-ring) 28%, transparent);
}

/* ---------- Кнопки ---------- */
.auth-btn {
    width: 100%;
    border: none;
    border-radius: 11px;
    padding: 12px 16px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: var(--tg-accent);
    color: var(--tg-btn-fg);
    transition: filter .15s, transform .05s;
}
.auth-btn:hover { filter: brightness(1.07); }
.auth-btn:active { transform: translateY(1px); }

/* ---------- Капча ---------- */
.auth-captcha { display: flex; align-items: center; gap: 12px; }
.auth-captcha img {
    display: block;
    height: 42px;
    border-radius: 8px;
    border: 1px solid var(--tg-divider);
    background: #fff;
    cursor: pointer;
}
.auth-captcha .auth-refresh {
    color: var(--tg-accent);
    text-decoration: none;
    font-size: .85rem;
    white-space: nowrap;
}
.auth-captcha .auth-refresh:hover { text-decoration: underline; }

/* ---------- Сообщения ---------- */
.auth-alert {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .9rem;
    margin: 0 0 18px;
}
.auth-alert:last-child { margin-bottom: 0; }
.tg-err  { background: #3a2323; color: #ff9a9a; }
.tg-warn { background: #3a3320; color: #ffd98a; }
.tg-ok   { background: #1f3a2a; color: #93e6b0; }
.tg-info { background: #1f3040; color: #9fd0ef; }
html[data-theme="light"] .tg-err  { background: #fdecec; color: #b02a2a; }
html[data-theme="light"] .tg-warn { background: #fdf3d9; color: #8a6d1f; }
html[data-theme="light"] .tg-ok   { background: #e5f6ec; color: #1f7a44; }
html[data-theme="light"] .tg-info { background: #e5f0fb; color: #1c6bb0; }

/* ---------- Ссылка-переключение под формой ---------- */
.auth-alt { text-align: center; margin: 20px 0 0; color: var(--tg-muted); font-size: .92rem; }
.auth-alt a { color: var(--tg-accent); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

/* ---------- Модерация: заголовки секций ---------- */
.auth-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 12px;
    display: flex; align-items: center; gap: 8px;
}
.auth-section-title .auth-count {
    font-size: .8rem; font-weight: 600;
    background: var(--tg-panel-2); color: var(--tg-muted);
    padding: 2px 9px; border-radius: 999px;
}
.auth-section { margin: 0 0 28px; }
.auth-section:last-child { margin-bottom: 0; }

/* ---------- Модерация: таблица ---------- */
.auth-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.auth-table th {
    text-align: left;
    color: var(--tg-muted);
    font-weight: 600;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--tg-divider);
}
.auth-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--tg-divider);
    vertical-align: middle;
    color: var(--tg-text);
}
.auth-table tr:last-child td { border-bottom: none; }
.auth-table tbody tr:hover td { background: var(--tg-hover); }
.auth-table .auth-id { color: var(--tg-muted); font-variant-numeric: tabular-nums; }
.auth-empty { color: var(--tg-muted); font-size: .9rem; margin: 4px 0 0; }

/* Бейджи статуса */
.auth-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
}
.auth-badge.is-active  { background: #1f3a2a; color: #93e6b0; }
.auth-badge.is-pending { background: #3a3320; color: #ffd98a; }
.auth-badge.is-banned  { background: #3a2323; color: #ff9a9a; }
html[data-theme="light"] .auth-badge.is-active  { background: #e5f6ec; color: #1f7a44; }
html[data-theme="light"] .auth-badge.is-pending { background: #fdf3d9; color: #8a6d1f; }
html[data-theme="light"] .auth-badge.is-banned  { background: #fdecec; color: #b02a2a; }

/* Кнопки действий в таблице */
.auth-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.auth-act {
    border: 1px solid var(--tg-divider);
    background: var(--tg-panel-2);
    color: var(--tg-text);
    border-radius: 9px;
    padding: 6px 12px;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.auth-act:hover { background: var(--tg-hover); }
.auth-act.is-primary { background: var(--tg-accent); color: var(--tg-btn-fg); border-color: transparent; }
.auth-act.is-primary:hover { filter: brightness(1.07); }
.auth-act.is-danger { color: #ff9a9a; border-color: #5a2b2b; }
.auth-act.is-danger:hover { background: #3a2323; }
html[data-theme="light"] .auth-act.is-danger { color: #b02a2a; border-color: #e6c2c2; }
html[data-theme="light"] .auth-act.is-danger:hover { background: #fdecec; }

/* ---------- Личный кабинет ---------- */
.acc-meta {
    display: flex; flex-direction: column;
    background: var(--tg-panel-2);
    border-radius: 12px;
    padding: 4px 14px;
    margin-bottom: 22px;
}
.acc-meta-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 2px;
    border-bottom: 1px solid var(--tg-divider);
    font-size: .92rem;
}
.acc-meta-row:last-child { border-bottom: none; }
.acc-meta-row > span { color: var(--tg-muted); }
.acc-meta-row > b { color: var(--tg-text); font-weight: 600; }

/* Стек кнопок действий */
.acc-actions { display: flex; flex-direction: column; gap: 12px; }
.acc-btn-link { display: block; text-align: center; text-decoration: none; }

/* Выход — по центру снизу */
.acc-logout-wrap { margin-top: 22px; }
.acc-logout-wrap .auth-form { align-items: center; }
.acc-logout { width: auto; padding-left: 22px; padding-right: 22px; }

/* ---------- Модальные окна ---------- */
.acc-modal {
    position: fixed; inset: 0; z-index: 50;
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
}
.acc-modal.is-open { display: flex; }
.acc-modal-card {
    width: 100%; max-width: 360px;
    background: var(--tg-panel);
    border: 1px solid var(--tg-divider);
    border-radius: 16px;
    padding: 22px 22px 24px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
    animation: acc-pop .16s ease-out;
}
@keyframes acc-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.acc-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 1.08rem; font-weight: 700;
    margin-bottom: 18px;
}
.acc-modal-close {
    width: 30px; height: 30px;
    border: none; border-radius: 9px;
    background: var(--tg-panel-2);
    color: var(--tg-muted);
    font-size: 20px; line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.acc-modal-close:hover { background: var(--tg-hover); color: var(--tg-text); }


/* ---------- Адаптив ---------- */
@media (max-width: 560px) {
    .auth-card { padding: 24px 18px; border-radius: 14px; }
    .auth-table { font-size: .82rem; }
    .auth-table th, .auth-table td { padding: 8px 6px; }
}
