/**
 * ============================================================================
 * AUTH.CSS - Unified styles for authentication pages
 * ============================================================================
 * Единый стиль для: login, register, forgot-password, reset-password
 * ============================================================================
 */

/* -------------------- AUTH CONTAINER -------------------- */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.4s ease-out;
}

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

/* -------------------- AUTH LOGO -------------------- */

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

.auth-logo .logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(58, 122, 254, 0.3);
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 10px 0 5px 0;
    color: var(--text);
    letter-spacing: -0.5px;
}

.auth-logo p {
    color: var(--text);
    opacity: 0.6;
    font-size: 14px;
    margin: 0;
}

/* -------------------- FORM GROUPS -------------------- */

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text);
    opacity: 0.6;
    line-height: 1.4;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(58, 122, 254, 0.1);
}

.form-group input::placeholder {
    color: var(--text);
    opacity: 0.4;
}

.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* -------------------- BUTTONS -------------------- */

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    position: relative;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
}

/* -------------------- ALERTS -------------------- */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert::before {
    font-size: 18px;
}

.alert-error {
    background: rgba(246, 97, 81, 0.1);
    border: 1px solid rgba(246, 97, 81, 0.3);
    color: #f66151;
}

.alert-error::before {
    content: '❌';
}

.alert-success {
    background: rgba(51, 209, 122, 0.1);
    border: 1px solid rgba(51, 209, 122, 0.3);
    color: #33d17a;
}

.alert-success::before {
    content: '✅';
}

.alert-info {
    background: rgba(58, 122, 254, 0.1);
    border: 1px solid rgba(58, 122, 254, 0.3);
    color: var(--accent);
}

.alert-info::before {
    content: 'ℹ️';
}

.alert-warning {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    color: #ffaa00;
}

.alert-warning::before {
    content: '⚠️';
}

.hidden {
    display: none !important;
}

/* -------------------- AUTH LINKS -------------------- */

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text);
    opacity: 0.7;
}

.auth-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 6px;
}

.auth-links a:hover {
    text-decoration: underline;
}

.forgot-password {
    text-align: center;
    margin-top: 15px;
}

.forgot-password a {
    color: var(--text);
    opacity: 0.6;
    font-size: 14px;
    text-decoration: none;
}

.forgot-password a:hover {
    color: var(--accent);
    opacity: 1;
    text-decoration: underline;
}

/* -------------------- LOADING SPINNER -------------------- */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* -------------------- PASSWORD STRENGTH (для register/reset) -------------------- */

.password-requirements {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.password-requirements-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
    font-size: 14px;
}

.requirement {
    display: flex;
    align-items: center;
    margin: 8px 0;
    color: var(--text);
    opacity: 0.5;
    transition: all 0.2s;
}

.requirement.met {
    opacity: 1;
    color: var(--accent2);
}

.requirement-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

.requirement.met .requirement-indicator {
    background: var(--accent2);
    border-color: var(--accent2);
    color: white;
}

/* Password strength bar */
.password-strength {
    margin-top: 10px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s;
    border-radius: 2px;
}

.password-strength-bar.weak {
    width: 25%;
    background: #f66151;
}

.password-strength-bar.medium {
    width: 60%;
    background: #ffaa00;
}

.password-strength-bar.strong {
    width: 100%;
    background: var(--accent2);
}

.password-strength-label {
    margin-top: 6px;
    font-size: 12px;
    text-align: right;
    font-weight: 500;
}

/* -------------------- MOBILE OPTIMIZATION -------------------- */

@media (max-width: 480px) {
    .auth-card {
        padding: 30px 20px;
        max-width: 100%;
    }

    .auth-logo .logo-icon {
        width: 64px;
        height: 64px;
    }

    .auth-logo h1 {
        font-size: 24px;
    }

    .auth-logo p {
        font-size: 13px;
    }

    .form-group input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .btn-primary,
    .btn-secondary {
        padding: 12px;
        font-size: 15px;
    }
}

/* -------------------- DARK/LIGHT THEME ADJUSTMENTS -------------------- */

html[data-theme="light"] .auth-logo .logo-icon {
    box-shadow: 0 4px 12px rgba(39, 100, 245, 0.2);
}

html[data-theme="light"] .alert-error {
    background: rgba(246, 97, 81, 0.05);
}

html[data-theme="light"] .alert-success {
    background: rgba(51, 209, 122, 0.05);
}

html[data-theme="light"] .alert-info {
    background: rgba(39, 100, 245, 0.05);
}
