/* Matrix Nexus 认证页面样式 */

:root {
    /* Primary Colors */
    --primary-color: #00ff41;
    --primary-dark: #00cc33;
    --secondary-color: #0a0e27;
    --error-color: #f85149;
    --success-color: #3fb950;
    --shadow: 0 8px 24px var(--primary-rgba-015, rgba(0, 255, 65, 0.15));
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Dark Theme (Default) */
    --background-color: #0d1117;
    --surface-color: #161b22;
    --text-color: #c9d1d9;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --bg-primary: #0a0a0a;
    --bg-secondary: #111;
    --hover-bg: rgba(255, 255, 255, 0.05);
    
    /* Light Theme Variables */
    --light-background-color: #f5f7fa;
    --light-surface-color: #ffffff;
    --light-text-color: #1a1a1a;
    --light-text-secondary: #6c757d;
    --light-border-color: #dee2e6;
    --light-bg-primary: #ffffff;
    --light-bg-secondary: #f8f9fa;
    --light-hover-bg: #f1f3f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, var(--background-color) 0%, #1a1f36 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.6;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    animation: fadeInUp 0.6s ease-out;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    display: block;
    border-radius: 12px;
}

/* Theme-aware logo display: dark logo for dark theme, light logo for light theme */
.logo-icon.logo-dark {
    display: block;
}

.logo-icon.logo-light {
    display: none;
}

:root[data-theme="light"] .logo-icon.logo-dark {
    display: none;
}

:root[data-theme="light"] .logo-icon.logo-light {
    display: block;
}

.logo-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 20px var(--primary-rgba-050, rgba(0, 255, 65, 0.5));
}

.auth-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.form-label .required {
    color: var(--error-color);
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-rgba-010, rgba(0, 255, 65, 0.1));
}

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

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

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.1);
}

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

.form-input.success:focus {
    box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.1);
}

.error-message {
    display: none;
    margin-top: 8px;
    font-size: 13px;
    color: var(--error-color);
}

.error-message.show {
    display: block;
}

.success-message {
    display: none;
    margin-top: 8px;
    font-size: 13px;
    color: var(--success-color);
}

.success-message.show {
    display: block;
}

/* 输入框带按钮布局 */
.input-with-button {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.input-with-button .form-input {
    flex: 1;
    min-width: 0;
}

.btn-validate {
    padding: 12px 16px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-validate:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--secondary-color);
}

.btn-validate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Light Theme 支持 */
body[data-theme="light"] .btn-validate {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #1a1a1a;
}

body[data-theme="light"] .btn-validate:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--secondary-color);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    animation: slideDown 0.3s ease-out;
}

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

.alert.show {
    display: block;
}

.alert-error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.alert-success {
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.btn {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--secondary-color);
    box-shadow: 0 4px 12px var(--primary-rgba-030, rgba(0, 255, 65, 0.3));
}

/* Cloudflare Turnstile 人机验证容器 */
.turnstile-container {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.turnstile-container iframe {
    border-radius: 8px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-rgba-040, rgba(0, 255, 65, 0.4));
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-disabled-state {
    background: var(--border-color, #30363d) !important;
    color: var(--text-secondary, #8b949e) !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--secondary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.form-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.form-footer a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

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

/* 响应式设计 */
@media (max-width: 640px) {
    .auth-card {
        padding: 24px;
    }

    .auth-title {
        font-size: 24px;
    }

    .logo {
        font-size: 28px;
    }

    .logo::before {
        font-size: 36px;
    }
}

/* 深色模式优化（已经是深色主题）*/
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, var(--background-color) 0%, #1a1f36 100%);
    }
}

/* 无障碍支持 */
.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;
}

/* 焦点可见性 */
.btn:focus-visible,
.form-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Light Theme Specific Styles */
body[data-theme="light"] .auth-card {
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .form-input {
    background: #f8f9fa;
    border-color: #dee2e6;
}

body[data-theme="light"] .form-input:focus {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-rgba-010, rgba(0, 255, 65, 0.1));
}

body[data-theme="light"] .btn-secondary {
    background: #f8f9fa;
    color: #1a1a1a;
    border-color: #dee2e6;
}

body[data-theme="light"] .btn-secondary:hover {
    background: #e9ecef;
}

body[data-theme="light"] .logo-text {
    text-shadow: 0 0 10px var(--primary-rgba-020, rgba(0, 255, 65, 0.2));
}

body[data-theme="light"] .alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

body[data-theme="light"] .alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

/* ==================== OAuth Social Login Buttons ==================== */

.oauth-section {
    margin-top: 8px;
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.btn-oauth:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

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

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

/* Google Button */
.btn-google {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-google:hover {
    background: var(--hover-bg);
    border-color: #4285F4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
}

/* GitHub Button */
.btn-github {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-github:hover {
    background: var(--hover-bg);
    border-color: #8b949e;
    box-shadow: 0 2px 8px rgba(139, 148, 158, 0.2);
}

/* Light Theme OAuth Buttons */
body[data-theme="light"] .btn-google {
    background: #ffffff;
    color: #1a1a1a;
    border-color: #dee2e6;
}

body[data-theme="light"] .btn-google:hover {
    background: #f8f9fa;
    border-color: #4285F4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
}

body[data-theme="light"] .btn-github {
    background: #ffffff;
    color: #1a1a1a;
    border-color: #dee2e6;
}

body[data-theme="light"] .btn-github:hover {
    background: #f8f9fa;
    border-color: #24292f;
    box-shadow: 0 2px 8px rgba(36, 41, 47, 0.15);
}

/* Divider bottom (before "Register now") */
.divider-bottom {
    margin-top: 24px;
    margin-bottom: 0;
}

/* ==================== Forgot Password Link ==================== */

.forgot-password-link {
    text-align: right;
    margin-top: -16px;
    margin-bottom: 20px;
}

.forgot-password-link a {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.forgot-password-link a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* ==================== Password Reset States ==================== */

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* Success State */
.success-state {
    text-align: center;
    padding: 24px 0;
    animation: fadeInUp 0.5s ease-out;
}

.success-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(63, 185, 80, 0.1);
    margin-bottom: 20px;
}

.success-icon {
    width: 32px;
    height: 32px;
    color: var(--success-color);
}

.success-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}

.success-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.success-hint {
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Invalid/Expired State */
.invalid-state {
    text-align: center;
    padding: 24px 0;
    animation: fadeInUp 0.5s ease-out;
}

.invalid-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(248, 81, 73, 0.1);
    margin-bottom: 20px;
}

.invalid-icon {
    width: 32px;
    height: 32px;
    color: var(--error-color);
}

.invalid-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}

.invalid-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Light Theme overrides for new states */
body[data-theme="light"] .success-icon-wrapper {
    background: rgba(16, 185, 129, 0.1);
}

body[data-theme="light"] .invalid-icon-wrapper {
    background: rgba(239, 68, 68, 0.1);
}

body[data-theme="light"] .loading-spinner {
    border-color: #dee2e6;
    border-top-color: var(--primary-color);
}
