/**
 * Dark Theme CSS - 暗黑简约风格
 *
 * 设计理念：
 * - 深色主题，减少眼睛疲劳
 * - 极简设计，突出内容
 * - 优雅的过渡动画
 * - 清晰的视觉层次
 * - 支持亮白/暗黑模式切换
 */

/* ===== 本地字体 ===== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/Inter-Light.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/Inter-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/Inter-Medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/Inter-Bold.woff2') format('woff2');
}

/* ===== CSS 变量 ===== */
:root {
    --color-bg: #17191C;
    --color-card: #32363c;
    --color-card-hover: #383d44;
    --color-border: #3f444e;
    --color-border-hover: #4a5568;
    --color-text: #e5e5e5;
    --color-text-muted: #9ca3af;
    --color-text-light: #d1d5db;
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --primary-light: rgba(96, 165, 250, 0.15);
    --color-danger: #ef4444;
    --color-success: #22c55e;
    --input-bg: rgba(0, 0, 0, 0.35);
    --input-bg-focus: rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 亮白模式变量 ===== */
:root[data-theme="light"] {
    --color-bg: #f5f5f7;
    --color-card: #ffffff;
    --color-card-hover: #ffffff;
    --color-border: #e5e5e7;
    --color-border-hover: #d4d4d8;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-text-light: #4b5563;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: rgba(59, 130, 246, 0.15);
    --input-bg: rgba(0, 0, 0, 0.03);
    --input-bg-focus: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.dark-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 背景装饰 ===== */
.dark-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(96, 165, 250, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(139, 92, 246, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(96, 165, 250, 0.06), transparent);
    animation: gradientMove 20s ease infinite;
}

:root[data-theme="light"] .bg-gradient {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 50%, rgba(139, 92, 246, 0.05), transparent),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(59, 130, 246, 0.04), transparent);
}

@keyframes gradientMove {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.bg-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ===== 主题切换按钮 ===== */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.theme-toggle:hover {
    background: var(--color-card-hover);
    border-color: var(--color-border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--color-text);
    transition: var(--transition);
}

.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

:root[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

:root[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

/* ===== 主容器 ===== */
.dark-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ===== 登录卡片 ===== */
.dark-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.dark-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.dark-card:hover {
    border-color: var(--color-border-hover);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] .dark-card:hover {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
}

/* ===== Logo 区域 ===== */
.card-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .logo-icon {
    background: linear-gradient(135deg, #1a1a1a, #000000);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* SVG 保持固定大小 */
.logo-icon svg {
    width: 36px;
    height: 36px;
}

/* 图片使用原始大小，移除容器背景装饰 */
.logo-icon:has(img) {
    width: auto;
    height: auto;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* 确保亮白模式下图片也没有阴影 */
:root[data-theme="light"] .logo-icon:has(img) {
    box-shadow: none !important;
}

.logo-icon img {
    width: auto;
    height: auto;
    max-width: 120px !important;
    max-height: 120px !important;
    display: block;
}

.logo-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 400;
}

/* ===== 分隔线 ===== */
.card-divider {
    margin-bottom: 32px;
}

.divider-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-border-hover), transparent);
}

/* ===== 表单区域 ===== */
.card-form {
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== 表单组 ===== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-light);
}

.form-label svg {
    flex-shrink: 0;
}

.form-input {
    width: 100%;
    padding: 13px 16px;
    background: var(--input-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--input-bg-focus);
    outline: none;
}

/* 亮白模式输入框焦点使用灰色 */
:root[data-theme="light"] .form-input:focus {
    border-color: #9ca3af !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08) !important;
    outline: none !important;
}

/* 亮白模式输入框 focus-visible 也使用灰色 */
:root[data-theme="light"] .form-input:focus-visible {
    outline: 2px solid #9ca3af !important;
    outline-offset: 2px;
}

/* 暗色模式输入框边框使用白色 */
:root .form-input:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25) !important;
    outline: none !important;
}

/* 暗色模式输入框 focus-visible */
:root .form-input:focus-visible {
    outline: none !important;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .form-input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: 4px;
}

.password-toggle:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.05);
}

/* ===== 记住我 ===== */
.form-options {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.checkbox-custom {
    position: relative;
    width: 18px;
    height: 18px;
    background: var(--input-bg);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-custom .check-icon {
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition);
    color: white;
}

.checkbox-input:checked + .checkbox-custom {
    background: #1e293b;
    border-color: #1e293b;
}

.checkbox-input:checked + .checkbox-custom .check-icon {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label:hover .checkbox-custom {
    border-color: var(--color-border-hover);
}

.checkbox-text {
    font-size: 13px;
    color: var(--color-text-light);
}

/* ===== 登录按钮 ===== */
.submit-button {
    width: 100%;
    padding: 13px 24px;
    background: #7c8495;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.submit-button:hover {
    background: #9ca3af;
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button.submitting {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-icon {
    transition: transform 0.3s ease;
}

.submit-button:hover .button-icon {
    transform: translateX(3px);
}

/* ===== 底部链接 ===== */
.card-footer {
    padding-top: 8px;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-link {
    font-size: 13px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary-color);
}

.footer-dot {
    color: var(--color-border);
    font-size: 12px;
}

/* ===== 页脚 ===== */
.dark-footer {
    margin-top: 32px;
    text-align: center;
}

.dark-footer p {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .dark-card {
        max-width: 100%;
        padding: 40px 28px;
    }

    .logo-title {
        font-size: 22px;
    }

    .logo-subtitle {
        font-size: 13px;
    }

    .card-logo {
        margin-bottom: 28px;
    }
}

@media (max-width: 480px) {
    .dark-wrapper {
        padding: 20px 16px;
    }

    .dark-card {
        padding: 32px 24px;
    }

    .logo-icon {
        width: 56px;
        height: 56px;
    }

    .logo-icon svg {
        width: 32px;
        height: 32px;
    }

    .logo-title {
        font-size: 20px;
    }
}

/* ===== 减少动画效果 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 焦点可见性 ===== */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 输入框移除焦点可见性样式 */
.form-input:focus-visible {
    outline: none !important;
}

/* 暗色模式输入框移除外框（更具体的选择器） */
:root:not([data-theme="light"]) .form-input:focus {
    outline: none !important;
}

:root:not([data-theme="light"]) .form-input:focus-visible {
    outline: none !important;
}

/* ===== 选择文本样式 ===== */
::selection {
    background: rgba(96, 165, 250, 0.3);
    color: var(--color-text);
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-hover);
}

/* ===== 消息提示 ===== */
.gate-message {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 9999;
    min-width: 280px;
    max-width: 400px;
    padding: 14px 18px;
    background: var(--color-card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--color-border);
}

.gate-message.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.gate-message.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
}

.gate-message.success .message-icon {
    color: #22c55e;
}

.gate-message.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.gate-message.error .message-icon {
    color: #ef4444;
}

.gate-message.notice {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
}

.gate-message.notice .message-icon {
    color: #f59e0b;
}

.message-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.message-content {
    flex: 1;
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text);
    line-height: 1.5;
}

.message-close {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 2px;
}

.message-close:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 480px) {
    .gate-message {
        min-width: auto;
        width: calc(100vw - 32px);
        top: 16px;
        max-width: none;
    }
}
