/* =============================================
   AUTH PAGES — авторизация, регистрация, сброс пароля
   ============================================= */

:root {
    --primary: #3F3FE6;
    --primary-dark: #3333C0;
    --primary-10: rgba(63, 63, 230, 0.1);
    --text-dark: #000000;
    --text-light: #6B6B6B;
    --border-input: rgba(183, 190, 255, 0.2);
    --border-btn: rgba(179, 187, 255, 0.5);
    --bg-tab: #F5F5FD;
    --bg-oauth: #F5F5FD;
    --bg-btn: rgba(179, 187, 255, 0.1);
    --divider: #F1F2FF;
    --white: #FFFFFF;
}

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

body {
    font-family: 'Manrope', sans-serif;
    background: #FFFFFF url('/static/background.png') center/cover no-repeat fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container { width: 100%; max-width: 400px; }

.auth-card {
    background: var(--white);
    border-radius: 30px;
    box-shadow: 0 0 20px rgba(0, 0, 196, 0.1);
    padding: 30px;
}

/* --- Логотип --- */
.logo-section {
    text-align: center;
    margin-bottom: 10px;
}
.logo-section img { height: 52px; }

/* --- Ссылка регистрации/входа --- */
.registration-link {
    text-align: center;
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}
.registration-link a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 700;
}

/* --- Заголовок --- */
.form-heading {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
    text-transform: capitalize;
}

/* --- Табы --- */
.auth-tabs {
    display: flex;
    background: var(--bg-tab);
    border-radius: 60px;
    margin-bottom: 20px;
    position: relative;
}
.auth-tab {
    flex: 1;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 60px;
    background: transparent;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}
.auth-tab--active {
    background: var(--white);
    color: var(--text-dark);
    border-color: var(--primary);
    z-index: 2;
}
.auth-tab:first-child:not(.auth-tab--active) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -14px;
    padding-right: 20px;
}
.auth-tab:last-child:not(.auth-tab--active) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -14px;
    padding-left: 20px;
}

/* --- Поля формы --- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}
.form-label a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

.form-control {
    width: 100%;
    padding: 8px 14px;
    border: 2px solid var(--border-input);
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-10);
}
.form-control::placeholder { color: #B0B0B0; }

.password-wrapper { position: relative; }
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(179, 187, 255, 0.6);
    padding: 4px;
    display: flex;
}

/* --- Кнопки --- */
.btn-row-right {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.btn-primary-outline {
    padding: 5px 28px;
    border: 2px solid var(--border-btn);
    border-radius: 20px;
    background: var(--bg-btn);
    color: rgba(0, 0, 0, 0.5);
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.btn-primary-outline:hover {
    border-color: var(--primary);
    background: var(--primary-10);
    color: var(--text-dark);
}

.btn-complete {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 20px;
    background: var(--primary);
    color: var(--white);
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-complete:hover { background: var(--primary-dark); }

/* --- Разделитель --- */
.divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 2px solid var(--divider);
}
.divider span { padding: 0 14px; }

/* --- OAuth кнопки --- */
.oauth-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
}
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 79px;
    height: 40px;
    border: 2px solid var(--primary);
    border-radius: 20px;
    background: var(--bg-oauth);
    cursor: pointer;
    transition: background 0.2s;
}
.oauth-btn:hover { background: var(--primary-10); }
.oauth-icon { height: 22px; width: auto; }

/* --- Алерты --- */
.alert {
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error { background: #FEE; color: #C33; border: 1px solid #FCC; }
.alert-success { background: #EFE; color: #3A3; border: 1px solid #CFC; }

/* --- Навигация --- */
.btn-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 8px;
}

.btn-back-circle {
    width: 45px;
    height: 32px;
    border-radius: 20px;
    border: 2px solid #B7BEFF;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-back-circle:hover { background: var(--bg-tab); }

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
}

/* --- OTP --- */
.otp-message {
    text-align: center;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.4;
}
.otp-message strong {
    display: block;
    margin-top: 4px;
}

.otp-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.otp-input {
    width: 40px;
    height: 45px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid rgba(183, 190, 255, 0.3);
    border-radius: 10px;
    background: var(--white);
    color: var(--text-dark);
    font-family: 'Manrope', sans-serif;
    padding: 0;
}
.otp-input:focus {
    outline: none;
    border-color: #4D4DD6;
    border-width: 3px;
}

.otp-resend-btn {
    display: block;
    width: 100%;
    padding: 5px 20px;
    border: 2px solid #B3BBFF;
    border-radius: 20px;
    background: var(--bg-btn);
    color: var(--text-dark);
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    margin-bottom: 20px;
    transition: background 0.2s, border-color 0.2s;
}
.otp-resend-btn:not(:disabled):hover {
    border-color: var(--primary);
    background: var(--primary-10);
    color: var(--text-dark);
}
.otp-resend-btn:disabled {
    cursor: default;
}

.otp-bottom-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 8px;
}

.otp-bottom-row .btn-back-circle {
    grid-column: 1;
    justify-self: start;
}

.otp-help-link {
    grid-column: 2;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
}

/* --- Модалка помощи --- */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.help-overlay.open {
    opacity: 1;
    visibility: visible;
}

.help-modal {
    background: var(--white);
    border-radius: 30px;
    box-shadow: 0 0 20px rgba(0, 0, 196, 0.1);
    padding: 30px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    font-family: 'Manrope', sans-serif;
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.help-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.help-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tab);
    border-radius: 50%;
    font-size: 18px;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.help-modal-close:hover { background: var(--border-input); }

.help-faq-item {
    margin-bottom: 16px;
    border: 2px solid var(--border-input);
    border-radius: 14px;
    overflow: hidden;
}

.help-faq-question {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    border: none;
    width: 100%;
    text-align: left;
    font-family: 'Manrope', sans-serif;
    transition: background 0.15s;
}
.help-faq-question:hover { background: var(--bg-tab); }

.help-faq-arrow {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.help-faq-item.open .help-faq-arrow {
    transform: rotate(180deg);
}

.help-faq-answer {
    display: none;
    padding: 0 16px 12px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}
.help-faq-item.open .help-faq-answer {
    display: block;
}

.help-contact {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--bg-tab);
    border-radius: 14px;
    font-size: 13px;
    color: var(--text-dark);
    text-align: center;
    line-height: 1.5;
}
.help-contact a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

/* --- Адаптив --- */
@media (max-width: 576px) {
    .auth-card { padding: 24px 20px; }
    .form-heading { font-size: 20px; }
    .oauth-buttons { flex-wrap: wrap; }
}
