/* Переопределение стилей main для страниц авторизации/регистрации */
main.auth-main {
    padding: 2rem 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--header-bg);
    box-sizing: border-box;
}

/* Контейнер авторизации/регистрации */
.auth-container {
    width: 100%;
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 520px;
    position: relative;
    border-top: 4px solid var(--color-accent, #f8b500);
}

.auth-title {
    font-size: 1.75rem;
    text-align: center;
    color: var(--color-primary, #1e3c72);
    margin: 0 0 1.25rem 0;
    font-weight: 700;
}

.auth-login-message {
    text-align: center;
    color: var(--color-primary, #1e3c72);
    font-size: 1rem;
    margin: 0 0 1rem 0;
    padding: 0.75rem 1rem;
    background: rgba(42, 82, 152, 0.08);
    border-radius: 8px;
    border-left: 4px solid var(--color-accent, #f8b500);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-form .form-group label {
    font-weight: 600;
    color: var(--color-text-muted, #555);
    font-size: 0.875rem;
    margin: 0;
}

.auth-form .form-group input[type="text"],
.auth-form .form-group input[type="email"],
.auth-form .form-group input[type="password"],
.auth-form .form-group input[type="tel"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 2px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background-color: #fff;
    color: var(--color-text, #333);
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.auth-form .form-group input:focus {
    border-color: var(--color-primary-light, #2a5298);
    outline: none;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.auth-form .form-group input::placeholder {
    color: #aaa;
}

/* Блок пароля с кнопкой «показать/скрыть» */
.auth-form .input-group {
    display: flex;
    flex-wrap: nowrap;
}
.auth-form .input-group input {
    flex: 1;
    min-width: 0;
    border-radius: 8px 0 0 8px;
}
.auth-form .input-group-append {
    display: flex;
}
.auth-form .input-group-append .btn {
    border-radius: 0 8px 8px 0;
    border: 2px solid var(--color-border, #e0e0e0);
    border-left: none;
    padding: 0.75rem 0.9rem;
    background: #fff;
    color: var(--color-text-muted, #555);
}
.auth-form .input-group-append .btn:hover {
    background: var(--color-border, #e0e0e0);
    color: var(--color-text, #333);
}

.auth-form .auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}
.auth-form .auth-icon svg {
    width: 100%;
    height: 100%;
}
.auth-form .auth-icon[hidden] {
    display: none !important;
}

.auth-form .forgot-password-link {
    text-align: right;
    margin-top: -0.5rem;
}

.auth-form .forgot-password-link a {
    color: var(--color-primary-light, #2a5298);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    font-weight: 500;
    border-bottom: 1px solid transparent;
}

.auth-form .forgot-password-link a:hover {
    color: var(--color-secondary, #26d0ce);
    border-bottom-color: var(--color-secondary, #26d0ce);
}

.auth-form .form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.auth-form .btn-submit,
.auth-form .btn-reset {
    flex: 1;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-form .btn-submit {
    background: linear-gradient(135deg, var(--color-primary, #1e3c72) 0%, var(--color-primary-light, #2a5298) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.4);
}

.auth-form .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.5);
    background: linear-gradient(135deg, var(--color-primary-light, #2a5298) 0%, var(--color-secondary, #26d0ce) 100%);
}

.auth-form .btn-submit:active {
    transform: translateY(0);
}

.auth-form .btn-reset {
    background-color: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0;
}

.auth-form .btn-reset:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.auth-form .register-link {
    text-align: center;
    margin-top: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border, #e0e0e0);
    color: var(--color-text-light, #666);
    font-size: 0.9rem;
}

.auth-form .register-link a {
    color: var(--color-primary-light, #2a5298);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.auth-form .register-link a:hover {
    color: var(--color-secondary, #26d0ce);
    border-bottom-color: var(--color-secondary, #26d0ce);
}

.auth-form .feedback-message {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    min-height: 0.8rem;
    font-weight: 500;
}

.auth-form .feedback-message.error {
    color: #dc3545;
}

.auth-form .feedback-message.success {
    color: #28a745;
}

@media (max-width: 576px) {
    main.auth-main {
        min-height: calc(100vh - 120px);
        padding: 1.25rem 0 !important;
    }
    
    .auth-container {
        padding: 1rem 0.75rem;
    }
    
    .auth-card {
        padding: 1.25rem 1.25rem;
        max-width: 100%;
    }
    
    .auth-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .auth-form {
        gap: 0.75rem;
    }
    
    .auth-form .form-actions {
        flex-direction: column;
        gap: 0.625rem;
    }
}

/* Стили для модального окна (в т.ч. «Забыли пароль») — расположение повыше, в стиле темы */
.modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    align-items: flex-start;
    justify-content: center;
}
.modal.show {
    display: flex !important;
}

.modal-content {
    background-color: var(--color-surface, #fff);
    margin: 0 auto 2rem;
    padding: 2rem;
    padding-right: 3rem;
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-lg, 0 20px 60px rgba(0, 0, 0, 0.4));
    width: 90%;
    max-width: 480px;
    animation: modalSlideDown 0.3s ease-out;
    position: relative;
    border: 1px solid var(--color-border, #e0e0e0);
    border-top: 4px solid var(--color-accent, #f8b500);
}

@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 0.875rem;
    color: var(--color-primary, #1e3c72);
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-content p {
    color: var(--color-text-muted, #666);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.modal-form-group {
    margin-bottom: 1.5rem;
}

.modal-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted, #555);
    font-weight: 600;
    font-size: 0.875rem;
}

.modal-form-group input[type="email"],
.modal-form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 2px solid var(--color-border, #e0e0e0);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background-color: #fff;
    color: var(--color-text, #333);
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.modal-form-group input[type="email"]:focus,
.modal-form-group input[type="text"]:focus {
    border-color: var(--color-primary-light, #2a5298);
    outline: none;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.modal-form-group input::placeholder {
    color: #aaa;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.close {
    color: var(--color-text-muted, #aaa);
    position: absolute;
    right: var(--spacing-sm, 12px);
    top: var(--spacing-sm, 12px);
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm, 4px);
}

.close:hover,
.close:focus {
    color: var(--color-primary, #1e3c72);
    text-decoration: none;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background-color: #6c757d;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary, #1e3c72) 0%, var(--color-primary-light, #2a5298) 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.4);
    background: linear-gradient(135deg, var(--color-primary-light, #2a5298) 0%, var(--color-secondary, #26d0ce) 100%);
}

/* Тёмная тема: авторизация */
html[data-theme="dark"] body.page-auth {
    background-color: var(--color-background);
}
html[data-theme="dark"] main.auth-main {
    background: var(--header-bg);
}
html[data-theme="dark"] .auth-card {
    background: var(--color-surface-alt);
    border-top-color: var(--color-primary-light);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .auth-title {
    color: var(--color-primary-light);
}
html[data-theme="dark"] .auth-form .form-group label {
    color: var(--color-text-muted);
}
html[data-theme="dark"] .auth-form .form-group input[type="text"],
html[data-theme="dark"] .auth-form .form-group input[type="email"],
html[data-theme="dark"] .auth-form .form-group input[type="password"] {
    background-color: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
html[data-theme="dark"] .auth-form .form-group input:focus {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
html[data-theme="dark"] .auth-form .form-group input::placeholder {
    color: var(--color-text-muted);
}
html[data-theme="dark"] .auth-form .input-group-append .btn {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-muted);
}
html[data-theme="dark"] .auth-form .input-group-append .btn:hover {
    background: var(--color-border);
    color: var(--color-text);
}
html[data-theme="dark"] .auth-form .btn-submit {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}
html[data-theme="dark"] .auth-form .btn-submit:hover {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-secondary) 100%);
}
html[data-theme="dark"] .auth-form .btn-reset {
    background-color: var(--color-surface-alt);
    color: var(--color-text-muted);
    border-color: var(--color-border);
}
html[data-theme="dark"] .auth-form .btn-reset:hover {
    background-color: var(--color-border);
    border-color: var(--color-text-muted);
}
html[data-theme="dark"] .auth-form .register-link {
    border-top-color: var(--color-border);
    color: var(--color-text-muted);
}
html[data-theme="dark"] .auth-form .register-link a {
    color: var(--color-primary-light);
}
html[data-theme="dark"] .auth-form .register-link a:hover {
    color: var(--color-secondary);
}
html[data-theme="dark"] .auth-form .forgot-password-link a {
    color: var(--color-primary-light);
}
html[data-theme="dark"] .auth-form .forgot-password-link a:hover {
    color: var(--color-secondary);
}
/* Модальное окно «Забыли пароль» в тёмной теме */
html[data-theme="dark"] .modal-content {
    background-color: var(--color-surface-alt);
    border-top-color: var(--color-primary-light);
}
html[data-theme="dark"] .modal-content h2 {
    color: var(--color-primary-light);
}
html[data-theme="dark"] .modal-content p {
    color: var(--color-text-muted);
}
html[data-theme="dark"] .modal-form-group label {
    color: var(--color-text-muted);
}
html[data-theme="dark"] .modal-form-group input[type="email"],
html[data-theme="dark"] .modal-form-group input[type="text"] {
    background-color: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}
html[data-theme="dark"] .close {
    color: var(--color-text-muted);
}
html[data-theme="dark"] .close:hover {
    color: var(--color-text);
}
