/**
 * Authentication Pages Styles
 * Torch Analytics
 */

/* Auth Layout */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-color);
}

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

/* Auth Card */
.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
    color: inherit;
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-gradient-end));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.auth-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.auth-subtitle {
    color: var(--text-muted);
    margin: 0;
}

/* Auth Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: var(--text-main);
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus-ring-teal);
}

.auth-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.auth-input.error {
    border-color: var(--danger);
}

/* Password Field */
.password-field {
    position: relative;
}

.password-field .auth-input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--text-main);
}

/* Field Error */
.field-error {
    font-size: 0.8rem;
    color: var(--danger);
    display: none;
}

.auth-field.has-error .field-error {
    display: block;
}

/* Remember Me / Forgot Password */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.remember-me input {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--torch-teal);
}

/* Submit Button */
.auth-submit {
    width: 100%;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-gradient-end) 100%);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-teal-hover);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-submit .spinner {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

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

.auth-divider span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Social Login */
.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-main);
    background: var(--border-subtle);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-btn:hover {
    background: var(--border-color);
    border-color: var(--border-color-medium);
}

.social-btn .icon {
    font-size: 1.25rem;
}

.social-btn.social-apple {
    background: var(--social-apple-bg);
    color: var(--text-light);
    border-color: var(--social-apple-border);
}

.social-btn.social-apple:hover {
    background: var(--social-apple-hover);
}

.social-btn.social-google {
    background: var(--social-google-bg);
    color: var(--social-google-text);
    border-color: var(--social-google-border);
}

.social-btn.social-google:hover {
    background: var(--social-google-hover);
    border-color: var(--social-google-hover-border);
}

.social-btn.social-discord {
    background: var(--social-discord-bg);
    color: var(--text-light);
    border-color: transparent;
}

.social-btn.social-discord:hover {
    background: var(--social-discord-hover);
}

.social-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.social-btn .btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.social-btn svg.oauth-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

.auth-footer p {
    color: var(--text-muted);
    margin: 0;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--torch-teal);
}

/* Alert Messages */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.auth-alert.error {
    background: var(--alert-danger-bg);
    border: 1px solid var(--alert-danger-border);
    color: var(--alert-danger-text);
}

.auth-alert.success {
    background: var(--alert-success-bg);
    border: 1px solid var(--alert-success-border);
    color: var(--alert-success-text);
}

.auth-alert .icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Password Strength */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.strength-segment {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    transition: background 0.3s;
}

.strength-segment.active.weak { background: var(--danger); }
.strength-segment.active.fair { background: var(--warning-gradient-end); }
.strength-segment.active.good { background: var(--success-gradient-end); }
.strength-segment.active.strong { background: var(--success-dark); }

.strength-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Password Requirements */
.password-requirements {
    margin-top: 0.75rem;
    font-size: 0.8rem;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.requirement .icon {
    width: 1rem;
    text-align: center;
}

.requirement.met {
    color: var(--success);
}

.requirement.met .icon::before {
    content: '✓';
}

.requirement:not(.met) .icon::before {
    content: '○';
}

/* Terms */
.auth-terms {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1rem;
}

.auth-terms a {
    color: var(--primary);
    text-decoration: none;
}

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

/* Form Extras (remember me + forgot password row) */
.form-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

/* Forgot Password Form */
.forgot-form {
    display: none;
}

.forgot-form.visible {
    display: block;
}

.forgot-form .form-group {
    margin-bottom: 1rem;
}

.forgot-success {
    color: var(--success);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.forgot-error {
    color: var(--danger);
    font-size: 0.9rem;
}

/* Forgot form action elements */
.forgot-form-btn {
    width: 100%;
    margin-bottom: 0.75rem;
}

.forgot-back-link {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
}

/* OAuth Invite Code (beta gate) */
.oauth-invite-group {
    margin-top: 1rem;
}

.oauth-invite-group label {
    font-size: 0.85rem;
}

.oauth-invite-input {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

/* Auth success banner */
.auth-success-banner {
    margin-bottom: 1rem;
}

/* Hidden utility */
.auth-hidden {
    display: none;
}

/* Centered card variant */
.auth-card--centered {
    text-align: center;
}

/* Centered block (invalid-token, etc.) */
.auth-center-block {
    text-align: center;
    padding: 1rem 0;
}

/* Error text inside center blocks */
.auth-error-text {
    color: var(--danger);
    margin-bottom: 1rem;
}

/* Inline-display button modifier */
.primary-btn--inline {
    display: inline-block;
}

/* Margin-top utility */
.auth-mt {
    margin-top: 1rem;
}

/* Spinner for callback page */
.auth-spinner {
    margin: 2rem auto;
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* Error block for callback page */
.auth-error-block {
    color: var(--danger);
    margin-top: 1rem;
}

/* Wordmark size in register card */
.auth-card .torch-wordmark {
    font-size: 1.1rem;
}

/* Invite code input styling */
.auth-invite-input {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* External link color */
.auth-external-link {
    color: var(--primary);
}

/* Age verification group */
.auth-age-group {
    margin-top: 1.25rem;
}

/* Age verification label */
.auth-age-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* Age verification checkbox */
.auth-age-checkbox {
    margin-top: 0.15rem;
    flex-shrink: 0;
    accent-color: var(--primary);
}

/* Responsive */
@media (max-width: 480px) {
    .auth-layout {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
