/* ====================================
   Authentication Pages Styles (ENHANCED)
   REDitors - Noir Edition
   ==================================== */

/* ===== Auth Background Effects ===== */
.auth-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background: var(--bg);
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    top: -250px;
    left: -250px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    bottom: -200px;
    right: -200px;
    animation-delay: 5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    top: 50%;
    right: 20%;
    animation-delay: 10s;
}

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

/* ===== Back to Home Button ===== */
.back-home {
    position: fixed;
    top: var(--space-6);
    left: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-dim);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    transition: all var(--transition-base);
    z-index: 100;
    text-decoration: none;
}

.back-home:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateX(-4px);
}

.back-home i {
    width: 18px;
    height: 18px;
}

/* ===== Auth Wrapper ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-6);
    position: relative;
    z-index: 1;
}

/* ===== Auth Container ===== */
.auth-container {
    width: 100%;
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: var(--space-12);
    box-shadow: var(--shadow-2xl);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ===== Messages ===== */
.message {
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    animation: slideInDown 0.3s ease;
    position: relative;
}

.message.show {
    display: flex;
}

.success-message {
    background: rgba(68, 255, 68, 0.1);
    border: 1px solid rgba(68, 255, 68, 0.3);
    color: #44ff44;
}

.error-message {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.message-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.message-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.message-close i {
    width: 16px;
    height: 16px;
}

/* ===== Auth Header ===== */
.auth-header {
    text-align: center;
    margin-bottom: var(--space-10);
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.logo-text {
    font-size: var(--text-2xl);
    font-weight: var(--font-black);
    letter-spacing: -1px;
}

.logo-badge {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    padding: var(--space-1) var(--space-2);
    background: var(--accent);
    color: var(--bg);
    border-radius: var(--radius-base);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-black);
    margin-bottom: var(--space-2);
    letter-spacing: var(--tracking-tight);
    background: linear-gradient(135deg, var(--text) 0%, var(--text-dim) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    font-size: var(--text-base);
    color: var(--text-dim);
}

/* ===== Mode Tabs ===== */
.mode-tabs {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1);
    background: var(--bg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-8);
}

.tab-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-base);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition-base);
}

.tab-button i {
    width: 18px;
    height: 18px;
}

.tab-button:hover {
    color: var(--text);
    background: var(--bg-secondary);
}

.tab-button.active {
    background: var(--accent);
    color: var(--bg);
}

/* ===== Auth Form ===== */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.optional-badge {
    font-size: var(--text-xs);
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: var(--font-normal);
}

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

.input-icon {
    position: absolute;
    left: var(--space-4);
    width: 20px;
    height: 20px;
    color: var(--text-dim);
    pointer-events: none;
    z-index: 1;
}

.input-wrapper input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    padding-left: calc(var(--space-4) + 20px + var(--space-3));
    padding-right: calc(var(--space-4) + 36px);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    color: var(--text);
    font-size: var(--text-base);
    transition: all var(--transition-base);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

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

.input-wrapper input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.input-wrapper input.success {
    border-color: var(--success);
}

/* Input Status Indicator */
.input-status {
    position: absolute;
    right: var(--space-4);
    display: none;
}

.input-status.checking::after {
    content: '⋯';
    color: var(--text-dim);
}

.input-status.available::after {
    content: '✓';
    color: var(--success);
}

.input-status.taken::after {
    content: '✗';
    color: var(--error);
}

/* Toggle Password */
.toggle-password {
    position: absolute;
    right: var(--space-4);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: var(--radius-base);
    transition: all var(--transition-base);
    z-index: 1;
}

.toggle-password:hover {
    background: var(--bg-tertiary);
    color: var(--text);
}

.toggle-password .eye-closed {
    display: none;
}

.toggle-password.active .eye-open {
    display: none;
}

.toggle-password.active .eye-closed {
    display: block;
}

.toggle-password i {
    width: 18px;
    height: 18px;
}

/* Error Text */
.error-text {
    display: none;
    font-size: var(--text-xs);
    color: var(--error);
    margin-top: var(--space-2);
}

.error-text:not(:empty) {
    display: block;
}

/* Help Text */
.help-text {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-2);
}

/* ===== Form Options ===== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    position: relative;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid var(--bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"]:focus-visible + .checkbox-custom {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.link-button {
    color: var(--accent);
    font-weight: var(--font-medium);
    transition: opacity var(--transition-base);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.link-button:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ===== Submit Button ===== */
.submit-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-base);
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

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

.submit-button:active:not(:disabled) {
    transform: translateY(0);
}

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

.button-text {
    display: inline-block;
    transition: opacity var(--transition-base);
}

.button-arrow {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-base);
}

.submit-button:hover .button-arrow {
    transform: translateX(4px);
}

.button-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    position: absolute;
}

.submit-button.loading .button-text,
.submit-button.loading .button-arrow {
    opacity: 0;
}

.submit-button.loading .button-loader {
    display: block;
}

/* ===== Divider ===== */
.divider {
    text-align: center;
    position: relative;
    margin: var(--space-6) 0;
    color: var(--text-dim);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

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

/* ===== Social Buttons ===== */
.social-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition-base);
}

.social-button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.social-icon {
    width: 20px;
    height: 20px;
}

.google-button .social-icon {
    width: 18px;
    height: 18px;
}

/* ===== Password Strength ===== */
.password-strength {
    margin-top: var(--space-3);
}

.strength-bar {
    height: 4px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all var(--transition-base);
    border-radius: var(--radius-full);
}

.strength-fill.weak {
    width: 25%;
    background: var(--error);
}

.strength-fill.fair {
    width: 50%;
    background: var(--warning);
}

.strength-fill.good {
    width: 75%;
    background: var(--info);
}

.strength-fill.strong {
    width: 100%;
    background: var(--success);
}

.strength-text {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.strength-text.weak {
    color: var(--error);
}

.strength-text.fair {
    color: var(--warning);
}

.strength-text.good {
    color: var(--info);
}

.strength-text.strong {
    color: var(--success);
}

.strength-requirements {
    margin-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.requirement {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    transition: all var(--transition-base);
}

.requirement i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

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

/* ===== Checkbox Wrapper ===== */
.checkbox-wrapper {
    margin-bottom: var(--space-5);
}

.checkbox-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.checkbox-text .link {
    color: var(--accent);
    text-decoration: underline;
}

.checkbox-text .link:hover {
    opacity: 0.8;
}

/* ===== Password Reset Header ===== */
.password-reset-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.header-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    color: var(--accent);
}

.password-reset-header h3 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
}

.password-reset-header p {
    color: var(--text-dim);
    font-size: var(--text-sm);
}

/* ===== Security Badge ===== */
.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-base);
    margin-top: var(--space-6);
    color: var(--success);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}

.security-badge i {
    width: 16px;
    height: 16px;
}

/* ===== Auth Footer ===== */
.auth-footer {
    margin-top: var(--space-8);
    text-align: center;
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
}

.footer-text {
    font-size: var(--text-sm);
    color: var(--text-dim);
}

.footer-text .link-button {
    margin-left: var(--space-2);
}

/* ===== Trust Indicators ===== */
.trust-indicators {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    margin-top: var(--space-8);
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-dim);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

.trust-item i {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-dark);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-4);
    z-index: var(--z-modal);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: var(--text-base);
    color: var(--text-dim);
    font-weight: var(--font-medium);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

/* ===== Responsive Auth ===== */
@media (max-width: 640px) {
    .auth-wrapper {
        padding: var(--space-4);
    }
    
    .auth-container {
        padding: var(--space-8);
    }
    
    .auth-title {
        font-size: var(--text-2xl);
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .social-buttons {
        grid-template-columns: 1fr;
    }
    
    .trust-indicators {
        gap: var(--space-4);
    }
    
    .trust-item {
        font-size: var(--text-xs);
    }
    
    .back-home {
        position: static;
        margin-bottom: var(--space-6);
    }
}

/* ===== Focus Styles ===== */
.auth-container *:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== Screen Reader Only ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===== Dark Mode Adjustments ===== */
[data-theme="light"] .auth-background {
    background: var(--bg);
}

[data-theme="light"] .gradient-orb {
    opacity: 0.08;
}

[data-theme="light"] .auth-container {
    background: var(--bg-secondary);
}

[data-theme="light"] .input-wrapper input {
    background: var(--bg);
}