/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-content {
    background: #ffffff;
    margin: auto;
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    border: 1px solid rgba(139, 92, 246, 0.1);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Кнопка закрытия */
.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 28px;
    font-weight: 300;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: rotate(90deg);
}

/* Заголовки (несемантические - .modal-heading вместо h2) */
.modal-heading {
    display: block;
    font-size: 1.75rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Форма */
.auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #ffffff;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    transform: translateY(-1px);
}

.form-group input:hover {
    border-color: #d1d5db;
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Обертка для поля пароля с кнопкой глаза */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 3rem; /* место для кнопки */
    margin: 0;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    font-size: 1rem;
    z-index: 1;
}

.password-toggle:hover {
    color: #6b7280;
}

.password-toggle:focus {
    outline: none;
    color: #8b5cf6;
}

/* Checkbox стили */
.checkbox-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px;
    margin-right: 0.75rem;
    accent-color: #8b5cf6;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 0.9rem;
    color: #6b7280;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-sizing: border-box;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.2);
}

/* Ссылки переключения */
.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.auth-switch a {
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.auth-switch a:hover {
    color: #7c3aed;
    text-decoration: underline;
}

.auth-switch a:active {
    transform: scale(0.98);
}

/* Дополнительные стили для формы сброса пароля */
.auth-form p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* Адаптивность */
@media (max-width: 480px) {
    .modal-content {
        margin: 1rem;
        padding: 2rem;
        max-width: none;
        border-radius: 12px;
    }
    
    .modal-heading {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-group input {
        padding: 0.875rem 1rem;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
    }
}

/* Состояния загрузки */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled::before {
    display: none;
}

/* Сообщения об ошибках */
.error-message {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.form-group.error input {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Успешные сообщения */
.success-message {
    color: #10b981;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.form-group.success input {
    border-color: #10b981;
}

/* Дополнительные эффекты */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #a855f7, #ec4899);
    border-radius: 16px 16px 0 0;
}

/* Анимация для скрытия модального окна */
.modal.hiding {
    animation: fadeOut 0.3s ease;
}

.modal.hiding .modal-content {
    animation: slideOut 0.3s ease;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideOut {
    from { 
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to { 
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
}