/* static/css/login.css - страница входа, сплит-экран в цветах chat.css */

:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --border: #dde5ef;
    --text: #26364a;
    --text-muted: #708197;
    --accent: #425d84;
    --accent-hover: #34496a;
    --accent-contrast: #ffffff;
    --danger: #d1667c;
    --shadow: 0 1px 2px rgba(66, 93, 132, 0.08), 0 1px 10px rgba(66, 93, 132, 0.06);
    --radius-lg: 18px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--surface);
    color: var(--text);
}

.login-screen {
    display: flex;
    min-height: 100vh;
}

/* Левая панель - градиент вместо плоской заливки + два размытых пятна на фоне для глубины */
.login-panel {
    position: relative;
    overflow: hidden;
    flex: 1;
    background: linear-gradient(155deg, #4d6c98 0%, #35496a 65%, #2b3b56 100%);
    color: var(--accent-contrast);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-panel::before,
.login-panel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
}

.login-panel::before {
    width: 320px;
    height: 320px;
    background: #7fa0c9;
    opacity: 0.35;
    top: -100px;
    right: -80px;
}

.login-panel::after {
    width: 260px;
    height: 260px;
    background: #1f2b40;
    opacity: 0.55;
    bottom: -90px;
    left: -70px;
}

.login-panel-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    width: 100%;
    max-width: 340px;
}

.login-panel-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
}

.login-panel-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, white 18%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-panel-icon svg {
    width: 28px;
    height: 28px;
}

.login-panel h1 {
    font-size: 24px;
    font-weight: 600;
}

.login-panel p {
    max-width: 320px;
    font-size: 14.5px;
    line-height: 1.6;
    color: color-mix(in srgb, white 85%, transparent);
}

/* Мини-превью переписки - показывает, как выглядит сам чат, не настоящий диалог */
.login-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-preview-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.login-preview-row.user {
    justify-content: flex-end;
}

.login-preview-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-preview-avatar svg {
    width: 12px;
    height: 12px;
}

.login-preview-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.4;
    max-width: 230px;
    text-align: left;
}

.login-preview-row.user .login-preview-bubble {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.login-preview-row.bot .login-preview-bubble {
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    box-shadow: 0 6px 18px rgba(15, 23, 38, 0.25);
    border-bottom-left-radius: 4px;
}

.login-preview-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}

.login-preview-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: login-typing 1.4s infinite ease-in-out both;
}

.login-preview-dots span:nth-child(1) { animation-delay: -0.32s; }
.login-preview-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes login-typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Правая панель - форма входа */
.login-form-col {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--surface);
}

.login-form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.4;
}

.login-error svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.login-field input {
    font-family: inherit;
    font-size: 14.5px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    outline: none;
    transition: border-color 0.15s ease;
}

.login-field input:focus {
    border-color: var(--accent);
}

.password-input-wrap {
    position: relative;
    display: flex;
}

.password-input-wrap input {
    flex: 1;
    padding-right: 42px; /* место под кнопку-глазок, не залезает на текст */
}

.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.password-toggle:hover {
    color: var(--text);
    background: var(--border);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.password-toggle .icon-eye-off {
    display: none; /* показывается вместо icon-eye, когда пароль виден - переключает login.js */
}

.login-submit {
    margin-top: 6px;
    background: var(--accent);
    color: var(--accent-contrast);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px;
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.login-submit:hover { background: var(--accent-hover); }
.login-submit:active { transform: scale(0.98); }

.login-help-link {
    align-self: center;
    margin-top: 2px;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-help-link:hover { color: var(--accent-hover); }

/* Модалка "Нет доступа к чат-боту?" - тот же язык, что у диалогов в chat.css,
   но своя копия стилей: страница входа не подключает chat.css */

.app-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    border: none;
    border-radius: var(--radius-md);
    padding: 24px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow), 0 12px 40px rgba(0, 0, 0, 0.2);
}

.app-dialog::backdrop {
    background: rgba(10, 10, 14, 0.5);
    backdrop-filter: blur(2px);
}

.register-help-dialog {
    width: min(440px, calc(100vw - 40px));
    max-height: min(600px, calc(100vh - 40px));
    overflow-y: auto;
    border-radius: var(--radius-lg);
    padding: 28px;
}

.dialog-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.dialog-close:hover { color: var(--text); background: var(--bg); }
.dialog-close svg { width: 16px; height: 16px; }

.dialog-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
    padding-right: 24px; /* не наезжать на крестик закрытия */
}

.dialog-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.register-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 22px;
}

.register-step {
    display: flex;
    gap: 12px;
}

.register-step-number {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.register-step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}

.register-step-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.register-step-list {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.register-step-list li { margin-bottom: 2px; }

.dialog-actions {
    display: flex;
    justify-content: flex-end;
}

.dialog-btn {
    padding: 9px 16px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.dialog-btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.dialog-btn-primary:hover { background: var(--accent-hover); }

@media (max-width: 720px) {
    .login-screen {
        flex-direction: column;
    }

    .login-panel {
        flex: none;
        padding: 32px 24px;
    }

    .login-panel-intro {
        gap: 8px;
    }

    .login-panel p,
    .login-preview {
        display: none; /* на маленьком экране хватает заголовка, форма важнее */
    }

    .login-form-col {
        flex: 1;
        /* .login-form-col - row-flex (align-items двигает по вертикали, не justify-content).
           Без этого форма центрируется в оставшейся высоте (унаследовано с десктопа) -
           на телефоне это гигантский пустой отступ сверху, форма проваливается в середину */
        align-items: flex-start;
        padding: 40px 24px;
    }
}
