/* ── Auth Page ─────────────────────────────────────── */

body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.auth-logo h1 {
    font-size: 1.6rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.auth-logo p {
    font-size: 0.9rem;
    color: #888;
}

/* Tabs */
.auth-tabs {
    display: flex;
    border-radius: 8px;
    background: #f0f0f0;
    padding: 4px;
    margin-bottom: 1.5rem;
    gap: 4px;
}

.auth-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Alert */
.auth-alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.auth-alert.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.auth-alert.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.auth-alert.hidden {
    display: none;
}

/* Forms */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-form.active {
    display: flex;
}

/* Fields */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #444;
}

.field-group input {
    padding: 0.75rem 1rem;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}

.field-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

.field-group input.invalid {
    border-color: #dc2626;
}

.field-group input.valid {
    border-color: #16a34a;
}

/* Password wrapper */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.toggle-password:hover {
    opacity: 1;
}

/* Password strength */
.password-strength {
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    margin-top: 0.25rem;
    overflow: hidden;
    transition: all 0.3s;
}

.password-strength::after {
    content: '';
    display: block;
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s;
    width: var(--strength-width, 0%);
    background: var(--strength-color, #e0e0e0);
}

/* Turnstile */
.turnstile-wrapper {
    display: flex;
    justify-content: center;
    min-height: 65px;
}

/* Submit button */
.btn-auth {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.btn-auth:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-auth:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-spinner.hidden {
    display: none;
}

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

/* ── App Header user info ─────────────────────────── */
.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.header-user-name {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-logout {
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.35);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.25rem;
    }
}
