/* ========== СТРАНИЦА АВТОРИЗАЦИИ ========== */

/* Фикс для body при странице авторизации */
body.auth-page {
    overflow: auto; /* Возвращаем нормальный скролл */
}

.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Центрируем по вертикали */
    min-height: 100vh; /* Занимаем всю высоту окна */
    padding: 40px 20px;
    background: var(--light-bg);
    width: 100%;
}

.auth-tabs {
    display: flex;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: 30px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 500px;
}

.auth-tab {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.auth-tab.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

.auth-form.active {
    display: block;
    animation: authFadeIn 0.3s ease;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: 'Playfair Display', serif;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.auth-form-content {
    margin-bottom: 30px;
}

.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-form-label i {
    color: var(--primary);
    font-size: 13px;
}

.auth-form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--light-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    transition: var(--transition);
}

.auth-form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.1);
}

.auth-form-input::placeholder {
    color: var(--text-tertiary);
}

.auth-password-wrapper {
    position: relative;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: var(--transition-fast);
}

.auth-password-toggle:hover {
    color: var(--primary);
}

.auth-form-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 6px;
    min-height: 18px;
    display: none;
}

.auth-form-error.show {
    display: block;
    animation: authShake 0.3s ease;
}

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.auth-remember {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input {
    display: none;
}

.auth-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.auth-checkbox input:checked + .auth-checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.auth-checkbox input:checked + .auth-checkbox-custom::after {
    content: '✓';
    color: var(--white);
    font-size: 10px;
    font-weight: bold;
}

.auth-checkbox-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-forgot-link {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.auth-forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-password-strength {
    margin-top: 10px;
    display: none;
}

.auth-password-strength.show {
    display: block;
}

.auth-strength-bar {
    height: 4px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 6px;
}

.auth-strength-fill {
    height: 100%;
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.3s ease;
}

.auth-strength-fill.weak {
    width: 33%;
    background: #ef4444;
}

.auth-strength-fill.medium {
    width: 66%;
    background: #f59e0b;
}

.auth-strength-fill.strong {
    width: 100%;
    background: #10b981;
}

.auth-strength-text {
    font-size: 12px;
    color: var(--text-tertiary);
    display: block;
    text-align: right;
}

.auth-agreement {
    margin-bottom: 25px;
}

.auth-agreement .auth-checkbox-label {
    font-size: 13px;
    line-height: 1.4;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.auth-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.auth-submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.25);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}

.auth-divider span {
    padding: 0 15px;
}

.auth-social-buttons {
    display: flex;
    flex-direction: column; /* Изменено с grid на flex column */
    gap: 12px;
    margin-top: 20px;
}

.auth-social-btn {
    padding: 14px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%; /* Добавлено для полной ширины */
}

.auth-social-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.auth-social-google:hover {
    border-color: #DB4437;
    background: rgba(219, 68, 55, 0.05);
}

.auth-social-yandex:hover {
    border-color: #FC3F1D;
    background: rgba(252, 63, 29, 0.05);
}

.auth-social-icon {
    width: 18px;
    height: 18px;
}

.auth-back-link {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.auth-success {
    display: none;
    text-align: center;
    padding: 40px 20px;
    max-width: 500px;
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
}

.auth-success.active {
    display: block;
    animation: authFadeIn 0.3s ease;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--primary);
}

.auth-success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-family: 'Playfair Display', serif;
}

.auth-success-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.auth-success-btn {
    max-width: 300px;
    margin: 0 auto;
}

/* Адаптивность для страницы авторизации */
@media (max-width: 768px) {
    .auth-container {
        padding: 20px 16px;
        margin-top: 56px; /* Отступ для мобильной шапки */
        justify-content: flex-start; /* На мобильных начнем с верха */
        min-height: calc(100vh - 56px); /* Учитываем высоту шапки */
    }

    .auth-form {
        padding: 30px 24px;
    }

    .auth-tabs {
        max-width: 100%;
    }

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

    .auth-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 24px 20px;
    }

    .auth-tab span {
        display: none;
    }

    .auth-tab i {
        margin-right: 0;
    }

    .auth-tab {
        padding: 14px;
    }

    .auth-social-btn span {
        display: none;
    }

    .auth-social-btn {
        justify-content: center;
    }

    .auth-social-icon {
        margin-right: 0;
    }
}

/* Специальные стили для мобильной шапки на странице авторизации */
.auth-page .mobile-header-center {
    font-size: 18px;
    font-weight: 700;
    color: var(--sidebar-text);
}

.auth-page .mobile-menu-toggle {
    width: 40px;
    height: 40px;
}

/* Скрываем sidebar на мобильных если он перекрывает контент */
@media (max-width: 768px) {
    .sidebar.active ~ .main-content .auth-container {
        opacity: 0.3;
        pointer-events: none;
    }
}

/* Фикс для скролла на странице авторизации - УБРАНО ВСЁ ЛИШНЕЕ */
.auth-page .main-content {
    overflow-y: auto; /* Возвращаем нормальный скролл */
    height: auto;
}

/* Анимация загрузки */
.auth-loading {
    position: relative;
    pointer-events: none;
}

.auth-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.dark-theme .auth-loading::after {
    background: rgba(26, 15, 26, 0.8);
}

.auth-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: authSpin 1s linear infinite;
    z-index: 11;
}

@keyframes authSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Улучшенные стили для формы при скролле */
@media (max-height: 700px) {
    .auth-container {
        padding: 20px 20px 40px; /* Уменьшаем отступы при маленькой высоте */
        justify-content: flex-start; /* Начинаем с верха */
    }

    .auth-form {
        padding: 25px;
        margin-bottom: 20px;
    }

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

    .auth-header {
        margin-bottom: 20px;
    }

    .auth-title {
        font-size: 22px;
        margin-bottom: 5px;
    }

    .auth-subtitle {
        font-size: 14px;
    }
}

/* Для очень маленьких экранов */
@media (max-height: 500px) {
    .auth-container {
        padding: 15px 15px 30px;
    }

    .auth-form {
        padding: 20px;
    }

    .auth-tabs {
        margin-bottom: 15px;
    }

    .auth-title {
        font-size: 20px;
    }
}