/* ========================================
   Auth Pages - Login & Register
   ======================================== */

/* Page Container */
.auth-page {
    min-height: calc(100vh - 56px);
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 40px 20px;
}

/* Ambient Glows */
.auth-glow-tr {
    position: absolute;
    top: -180px;
    right: -180px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 85, 0, 0.07) 0%, transparent 70%);
    pointer-events: none;
}

.auth-glow-bl {
    position: absolute;
    bottom: -200px;
    left: -150px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 155, 213, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

/* Card */
.auth-outer {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
}

.auth-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 20px;
    padding: 36px 40px 32px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Logo */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    text-decoration: none;
}

.auth-logo-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 85, 0, 0.15), rgba(255, 85, 0, 0.05));
    border: 1px solid rgba(255, 85, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.auth-logo-text {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* Toggle Bar */
.auth-toggle-bar {
    display: flex;
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 8px;
}

.auth-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 9px 0;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.auth-toggle-btn:hover {
    color: var(--text-secondary);
}

.auth-toggle-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* Subtitle */
.auth-subtitle {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 0 0 24px;
    text-align: center;
    letter-spacing: 0.1px;
}

/* Form */
.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Field Wrapper */
.field-wrap {
    width: 100%;
    margin-bottom: 16px;
}

.field-label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.field-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    padding: 13px 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.field-input::placeholder {
    color: var(--text-muted);
}

.field-input:focus {
    border-color: var(--accent-primary);
}

.field-input.has-error {
    border-color: rgba(232, 82, 74, 0.5);
}

.field-input.valid {
    border-color: #4caf7a;
}

/* Override browser autofill styling */
.field-input:-webkit-autofill,
.field-input:-webkit-autofill:hover {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-tertiary) inset;
    box-shadow: 0 0 0 1000px var(--bg-tertiary) inset;
    border-color: var(--border-secondary);
    transition: background-color 5000s ease-in-out 0s;
}

.field-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-tertiary) inset;
    box-shadow: 0 0 0 1000px var(--bg-tertiary) inset;
    border-color: var(--accent-primary);
    transition: background-color 5000s ease-in-out 0s;
}

/* Field Error */
.field-error {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #e8524a;
    font-size: 12px;
    margin-top: 6px;
    font-weight: 600;
}

.field-error svg {
    flex-shrink: 0;
}

/* Password Strength Bar */
.strength-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.strength-track {
    display: flex;
    gap: 4px;
    flex: 1;
}

.strength-seg {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--bg-tertiary);
    transition: background 0.3s, box-shadow 0.3s;
}

.strength-seg.active {
    box-shadow: 0 0 6px currentColor;
}

.strength-seg.weak {
    background: #e8524a;
}

.strength-seg.fair {
    background: #ff9955;
}

.strength-seg.strong {
    background: #4caf7a;
}

.strength-label {
    font-size: 11.5px;
    font-weight: 700;
    min-width: 48px;
    text-align: right;
    letter-spacing: 0.3px;
}

.strength-label.weak {
    color: #e8524a;
}

.strength-label.fair {
    color: #ff9955;
}

.strength-label.strong {
    color: #4caf7a;
}

/* Login Error Banner */
.auth-error-banner {
    display: none;
    align-items: center;
    gap: 8px;
    background: rgba(232, 82, 74, 0.08);
    border: 1px solid rgba(232, 82, 74, 0.25);
    border-radius: 10px;
    padding: 10px 13px;
    color: #e8524a;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.auth-error-banner.visible {
    display: flex;
}

.auth-error-banner svg {
    flex-shrink: 0;
}

/* Forgot Password */
.forgot-row {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    margin-top: -8px;
}

.forgot-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.2px;
    padding: 0;
}

.forgot-btn:hover {
    text-decoration: underline;
}

/* Primary Button */
.auth-primary-btn {
    width: 100%;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    border: none;
    border-radius: 12px;
    padding: 13px 18px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(255, 85, 0, 0.32);
    letter-spacing: 0.3px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 85, 0, 0.4);
}

.auth-primary-btn:active {
    transform: translateY(0);
}

.auth-primary-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-primary-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Success State */
.auth-success-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0 8px;
    width: 100%;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(76, 175, 122, 0.1);
    border: 1px solid rgba(76, 175, 122, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-success-title {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}

.auth-success-sub {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 0;
    text-align: center;
}

/* Footer */
.auth-footer {
    width: 100%;
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-secondary);
}

.auth-footer p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   Legacy support for other forms
   ======================================== */

.auth-container {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-group input.valid {
    border-color: #22c55e;
}

.form-group input.invalid {
    border-color: #ef4444;
}

.btn-submit {
    background: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 0.5rem;
}

.btn-submit:hover {
    background: var(--accent-hover);
}

.btn-submit:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Auth Error (legacy) */
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    display: none;
}

.auth-error.visible {
    display: block;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 520px) {
    .auth-page {
        padding: 24px 16px;
        min-height: calc(100vh - 52px);
    }

    .auth-outer {
        max-width: 100%;
    }

    .auth-card {
        padding: 28px 24px 24px;
        border-radius: 16px;
    }

    .auth-logo {
        margin-bottom: 24px;
    }

    .auth-logo-icon {
        width: 34px;
        height: 34px;
    }

    .auth-logo-text {
        font-size: 16px;
    }

    .auth-subtitle {
        margin-bottom: 20px;
    }

    .field-wrap {
        margin-bottom: 14px;
    }

    .field-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .auth-primary-btn {
        padding: 13px 16px;
        font-size: 15px;
    }

    .auth-glow-tr {
        width: 300px;
        height: 300px;
        top: -120px;
        right: -120px;
    }

    .auth-glow-bl {
        width: 280px;
        height: 280px;
        bottom: -140px;
        left: -100px;
    }
}
