/**
 * Authentication Pages Styles
 * Login, Register, Forgot Password
 * Uses WOD3 Theme Design System
 */

:root {
    /* Brand Colors - Dark gray with amber */
    --auth-primary: #ffbe4d;
    --auth-secondary: #505152;
    --auth-accent: #1c1c1d;
    --auth-dark: #040405;

    /* Auth Page Colors */
    --auth-bg: #040405;
    --auth-card-bg: #1c1c1d;
    --auth-input-bg: #2a2a2b;
    --auth-text: #ffffff;
    --auth-text-secondary: rgba(255, 255, 255, 0.7);
    --auth-text-muted: rgba(255, 255, 255, 0.5);
    --auth-border: rgba(255, 255, 255, 0.1);
    --auth-error: #ef4444;
    --auth-success: #22c55e;

    /* Spacing */
    --auth-radius-sm: 6px;
    --auth-radius-md: 10px;
    --auth-radius-lg: 16px;
}

/* Page Layout */
.wod-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--auth-bg);
    position: relative;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wod-auth-page * {
    box-sizing: border-box;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 10;
}

/* Brand Section */
.auth-brand {
    text-align: center;
    margin-bottom: 32px;
    color: var(--auth-text);
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: rgba(255, 190, 77, 0.15);
    border: 2px solid rgba(255, 190, 77, 0.3);
    border-radius: var(--auth-radius-lg);
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.auth-logo:hover {
    transform: scale(1.05);
    background: rgba(255, 190, 77, 0.25);
    border-color: var(--auth-primary);
}

.auth-logo svg {
    stroke: var(--auth-primary);
}

.auth-brand h1 {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.auth-brand p {
    font-size: 15px;
    color: var(--auth-text-secondary);
    margin: 0;
}

/* Auth Card */
.auth-card {
    background: var(--auth-card-bg);
    border-radius: var(--auth-radius-lg);
    padding: 36px;
    border: 1px solid var(--auth-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Messages */
.auth-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--auth-radius-md);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--auth-error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-message.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--auth-success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.auth-message.info {
    background: rgba(255, 190, 77, 0.15);
    color: var(--auth-primary);
    border: 1px solid rgba(255, 190, 77, 0.3);
}

.auth-message svg {
    flex-shrink: 0;
}

/* Form Styles */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    stroke: var(--auth-text-secondary);
    pointer-events: none;
    transition: stroke 0.2s ease;
}

.form-input {
    width: 100%;
    height: 54px;
    padding: 0 50px;
    font-size: 15px;
    font-family: inherit;
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 2px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    outline: none;
    transition: all 0.2s ease;
}

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

.form-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-input:focus {
    border-color: var(--auth-primary);
    background: rgba(255, 190, 77, 0.05);
    box-shadow: 0 0 0 4px rgba(255, 190, 77, 0.1);
}

.form-input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
    stroke: var(--auth-primary);
}

/* Password Toggle */
.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password svg {
    stroke: var(--auth-text-secondary);
    transition: stroke 0.2s ease;
}

.toggle-password:hover svg {
    stroke: var(--auth-text);
}

.toggle-password .hidden {
    display: none;
}

/* Form Row - For side by side inputs */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -4px;
}

/* Custom Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: var(--auth-input-bg);
    border: 2px solid var(--auth-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-wrapper:hover .checkmark {
    border-color: rgba(255, 255, 255, 0.3);
}

.checkbox-wrapper input:checked ~ .checkmark {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.checkmark::after {
    content: '';
    display: none;
    width: 5px;
    height: 9px;
    border: solid var(--auth-dark);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-wrapper input:checked ~ .checkmark::after {
    display: block;
}

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

/* Links */
.auth-link {
    font-size: 14px;
    color: var(--auth-primary);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-link:hover {
    color: #ffd280;
    text-decoration: underline;
}

/* Submit Button */
.btn-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 54px;
    margin-top: 8px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: var(--auth-dark);
    background: var(--auth-primary);
    border: none;
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-auth::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ffd280 0%, #ffbe4d 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-auth:hover::before {
    opacity: 1;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(255, 190, 77, 0.5);
}

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

.btn-text,
.btn-icon {
    position: relative;
    z-index: 1;
}

.btn-icon {
    transition: transform 0.3s ease;
}

.btn-auth:hover .btn-icon {
    transform: translateX(4px);
}

/* Loading State */
.btn-auth.loading {
    pointer-events: none;
}

.btn-auth.loading .btn-text,
.btn-auth.loading .btn-icon {
    opacity: 0;
}

.btn-auth.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(4, 4, 5, 0.3);
    border-top-color: var(--auth-dark);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 2;
}

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

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0;
}

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

.auth-divider span {
    font-size: 12px;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Social Buttons (Optional) */
.social-buttons {
    display: flex;
    gap: 12px;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 28px;
}

.auth-footer-text {
    font-size: 14px;
    color: var(--auth-text-muted);
    margin: 0 0 16px 0;
}

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

.auth-footer-text a:hover {
    color: #ffd280;
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--auth-text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--auth-text);
}

.back-link svg {
    transition: transform 0.2s ease;
}

.back-link:hover svg {
    transform: translateX(-4px);
}

/* Background Decoration */
.auth-bg-decoration {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-gradient {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.bg-gradient-1 {
    width: 500px;
    height: 500px;
    background: rgba(255, 190, 77, 0.3);
    top: -200px;
    right: -100px;
    animation: float-1 20s ease-in-out infinite;
}

.bg-gradient-2 {
    width: 400px;
    height: 400px;
    background: rgba(255, 190, 77, 0.2);
    bottom: -150px;
    left: -100px;
    animation: float-2 15s ease-in-out infinite;
}

.bg-gradient-3 {
    width: 300px;
    height: 300px;
    background: rgba(80, 81, 82, 0.5);
    top: 40%;
    left: 20%;
    animation: float-3 18s ease-in-out infinite;
}

@keyframes float-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, 30px) scale(1.1); }
}

@keyframes float-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(0.9); }
}

@keyframes float-3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-20px, 20px); }
}

/* Password Strength Indicator */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

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

.strength-bar.weak { background: var(--auth-error); }
.strength-bar.medium { background: #f59e0b; }
.strength-bar.strong { background: var(--auth-success); }

.password-hint {
    font-size: 12px;
    color: var(--auth-text-muted);
    margin-top: 8px;
}

/* Terms Text */
.terms-text {
    font-size: 12px;
    color: var(--auth-text-muted);
    text-align: center;
    line-height: 1.6;
    margin-top: 16px;
}

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

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

/* Responsive */
@media (max-width: 480px) {
    .wod-auth-page {
        padding: 24px 16px;
    }

    .auth-brand h1 {
        font-size: 26px;
    }

    .auth-card {
        padding: 28px 24px;
        border-radius: var(--auth-radius-md);
    }

    .form-input {
        height: 50px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn-auth {
        height: 50px;
        font-size: 14px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .bg-gradient,
    .btn-auth,
    .btn-icon,
    .auth-logo,
    .back-link svg {
        animation: none;
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.form-input:focus-visible,
.btn-auth:focus-visible,
.toggle-password:focus-visible,
.auth-link:focus-visible,
.back-link:focus-visible,
.auth-logo:focus-visible,
.btn-social:focus-visible {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}

.checkbox-wrapper input:focus-visible ~ .checkmark {
    outline: 2px solid var(--auth-primary);
    outline-offset: 2px;
}
