/*!
 * ys-theme.css — 登录页明暗主题（浅色 + 暗色增量覆盖）
 * 依赖：<html data-theme="light|dark">，由 /assets/theme/theme.js 设置
 * 原则：本文件只“追加”暗色规则，不修改原有浅色样式，浅色外观与改造前保持一致
 */

/*
 * 明暗切换过渡
 * --------------------------------------------------------------------------
 * 只在切换瞬间给 <html> 挂 .ys-theme-anim（由 theme.js 添加，约 360ms 后移除），
 * 这样页面首次加载时不会把首屏颜色也“动画”一遍（那会看到颜色从默认值飘过来）。
 * 过渡只作用于背景色 / 文字色 / 边框色，不碰 transform、opacity，避免影响布局与动效。
 */
html.ys-theme-anim,
html.ys-theme-anim body,
html.ys-theme-anim body *,
html.ys-theme-anim body *::before,
html.ys-theme-anim body *::after {
    transition-property: background-color, color, border-color, box-shadow, fill, stroke;
    transition-duration: 320ms;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
    transition-delay: 0s;
}

@media (prefers-reduced-motion: reduce) {
    html.ys-theme-anim body,
    html.ys-theme-anim body *,
    html.ys-theme-anim body *::before,
    html.ys-theme-anim body *::after {
        transition-duration: 0s;
    }
}

:root {
    --ys-toggle-bg: #ffffff;
    --ys-toggle-border: #e2e8f4;
    --ys-toggle-fg: #475569;
    --ys-toggle-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    --ys-page-bg: #f0f4ff;
    --ys-surface: #ffffff;
    --ys-text: #1a1a2e;
    --ys-muted: #64748b;
    --ys-border: #e5e7eb;
    --ys-input-bg: #f9fafb;
}

html[data-theme="dark"] {
    --ys-toggle-bg: #1b2433;
    --ys-toggle-border: #2b3646;
    --ys-toggle-fg: #cbd5e1;
    --ys-toggle-shadow: 0 6px 18px rgba(0, 0, 0, .5);
    --ys-page-bg: #0b1220;
    --ys-surface: #141c2b;
    --ys-text: #e6edf7;
    --ys-muted: #8b98ac;
    --ys-border: #283241;
    --ys-input-bg: #1b2433;
}

/* ---------------- 右上角切换按钮 ---------------- */
.ys-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1080;
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--ys-toggle-border) !important;
    background: var(--ys-toggle-bg) !important;
    color: var(--ys-toggle-fg) !important;
    box-shadow: var(--ys-toggle-shadow);
    cursor: pointer;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
    transition: transform .18s ease, background .2s ease, color .2s ease, border-color .2s ease;
}

.ys-theme-toggle:hover {
    transform: translateY(-1px);
    border-color: #8fb4ff !important;
    color: #0d6efd !important;
}

html[data-theme="dark"] .ys-theme-toggle:hover {
    border-color: #d9a441 !important;
    color: #e0b163 !important;
}

.ys-theme-toggle:active { transform: translateY(0); }

.ys-theme-toggle:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.ys-theme-toggle i {
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
}

@media (max-width: 640px) {
    .ys-theme-toggle {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    .ys-theme-toggle i { font-size: 18px; }
}

/* 登录/注册卡片内形态：由 theme.js 放进 [data-theme-toggle-host] 时使用 */
.auth-form-top {
    display: flex;
    justify-content: flex-end;
    min-height: 36px;
    margin-bottom: 6px;
}

.ys-theme-toggle--card {
    position: static !important;
    width: 36px !important;
    height: 36px !important;
    background: var(--ys-input-bg) !important;
    border-color: var(--ys-border) !important;
    box-shadow: none !important;
    color: var(--ys-toggle-fg) !important;
}

.ys-theme-toggle--card:hover {
    border-color: #8fb4ff !important;
    color: #0d6efd !important;
    transform: none;
}

html[data-theme="dark"] .ys-theme-toggle--card {
    background: #1b2433 !important;
    border-color: #283241 !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .ys-theme-toggle--card:hover {
    border-color: #d9a441 !important;
    color: #e0b163 !important;
}

/* 页头内嵌形态：由 theme.js 放进 .unified-nav-right 时使用（前台站点） */
.ys-theme-toggle--inline {
    position: static !important;
    width: 36px !important;
    height: 36px !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    color: #64748b !important;
    margin-left: 2px;
    flex: 0 0 auto;
}

.ys-theme-toggle--inline:hover {
    background: rgba(24, 144, 255, .1) !important;
    color: #c9922f !important;
    border-color: transparent !important;
    transform: none;
}

html[data-theme="dark"] .ys-theme-toggle--inline {
    color: #a9b6c8 !important;
}

html[data-theme="dark"] .ys-theme-toggle--inline:hover {
    background: rgba(59, 130, 246, .18) !important;
    color: #f0bf63 !important;
}

@media (prefers-reduced-motion: reduce) {
    .ys-theme-toggle { transition: none; }
}

/* ---------------- 后台登录页（admin/login.php） ---------------- */
html[data-theme="dark"] body.login-page-admin {
    background-color: var(--ys-page-bg) !important;
    color: var(--ys-text);
}

html[data-theme="dark"] .login-page-admin .bg-white {
    background-color: var(--ys-page-bg) !important;
}

html[data-theme="dark"] .login-page-admin .form-control {
    background-color: var(--ys-input-bg);
    border-color: var(--ys-border);
    color: var(--ys-text);
}

html[data-theme="dark"] .login-page-admin .form-control:focus {
    background-color: #1f2a3a;
    border-color: #d9a441;
    color: #f1f5f9;
    box-shadow: 0 0 0 .25rem rgba(59, 130, 246, .18);
}

html[data-theme="dark"] .login-page-admin .form-control::placeholder {
    color: #6b7a90;
    opacity: 1;
}

html[data-theme="dark"] .login-page-admin .text-muted {
    color: var(--ys-muted) !important;
}

html[data-theme="dark"] .login-page-admin .alert-warning {
    background-color: #3a2f12;
    border-color: #5a4a1e;
    color: #f0d08a;
}

/* 左侧配图：暗色下压暗（浅色保持原样，不加任何滤镜） */
.login-page-admin .login-visual {
    position: relative;
}

html[data-theme="dark"] .login-page-admin .login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(2, 6, 23, .38) 0%, rgba(2, 6, 23, .68) 100%);
    pointer-events: none;
}

/* ---------------- 用户登录页（user/login.php） ---------------- */
html[data-theme="dark"] body.auth-page {
    background: var(--ys-page-bg);
}

html[data-theme="dark"] .auth-page .auth-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}

/* 品牌区：暗色下改为石墨 + 琥珀金，不再使用蓝色渐变 */
html[data-theme="dark"] .auth-page .auth-brand {
    background: linear-gradient(145deg, #2a2214 0%, #17181b 55%, #0f1012 100%);
}

html[data-theme="dark"] .auth-page .auth-brand::before,
html[data-theme="dark"] .auth-page .auth-brand::after {
    background: rgba(217, 164, 65, .10);
}

html[data-theme="dark"] .auth-page .auth-brand-icon {
    background: rgba(217, 164, 65, .16);
}

html[data-theme="dark"] .auth-page .auth-brand p {
    color: rgba(240, 191, 99, .82);
}

html[data-theme="dark"] .auth-page .auth-form-area {
    background: var(--ys-surface);
}

html[data-theme="dark"] .auth-page .auth-form-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .auth-page .auth-form-sub,
html[data-theme="dark"] .auth-page .auth-footer {
    color: var(--ys-muted);
}

html[data-theme="dark"] .auth-page .form-label {
    color: #cbd5e1;
}

html[data-theme="dark"] .auth-page .form-control {
    background: var(--ys-input-bg);
    border-color: var(--ys-border);
    color: #e6edf7;
}

html[data-theme="dark"] .auth-page .form-control:focus {
    background: #1f2a3a;
    border-color: #d9a441;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

html[data-theme="dark"] .auth-page .form-control::placeholder {
    color: #6b7a90;
    opacity: 1;
}

html[data-theme="dark"] .auth-page .alert-danger {
    background: #3a1d22;
    border-color: #5b2b33;
    color: #ff9aa5;
}

html[data-theme="dark"] .auth-page .alert-success {
    background: #12291f;
    border-color: #1e4634;
    color: #7ee2a8;
}

html[data-theme="dark"] .auth-page .alert-info {
    background: #1c1f24;
    border-color: #2c2f35;
    color: #cfd3da;
}

html[data-theme="dark"] .auth-page .auth-footer a {
    color: #e0b163;
}

html[data-theme="dark"] .auth-page .auth-footer a:hover {
    color: #f0bf63;
}

html[data-theme="dark"] .auth-page .btn-outline-primary {
    color: #e0b163;
    border-color: #6b5220;
}

html[data-theme="dark"] .auth-page .btn-outline-primary:hover {
    background: #2b2314;
    border-color: #d9a441;
    color: #f7e6c4;
}

html[data-theme="dark"] .auth-page .btn-outline-primary.active,
html[data-theme="dark"] .auth-page .btn-outline-primary:active {
    background: #c9922f;
    border-color: #c9922f;
    color: #ffffff;
}

html[data-theme="dark"] .auth-page .btn-outline-secondary {
    color: #cbd5e1;
    border-color: #3b4a63;
}

html[data-theme="dark"] .auth-page .btn-outline-secondary:hover {
    background: #22304a;
    border-color: #4b5d7a;
    color: #e2e8f0;
}

html[data-theme="dark"] .auth-page .quick-login-title {
    color: var(--ys-muted);
}

html[data-theme="dark"] .auth-page .quick-login-btn {
    background: var(--ys-input-bg);
    border-color: var(--ys-border);
}

html[data-theme="dark"] .auth-page .quick-login-btn:hover {
    background: #22304a;
    border-color: #6b5220;
}

html[data-theme="dark"] .auth-page .simple-modal {
    background: rgba(2, 6, 23, .72);
}

html[data-theme="dark"] .auth-page .simple-modal-card {
    background: #141c2b;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .6);
}

html[data-theme="dark"] .auth-page .simple-modal-title {
    color: #f1f5f9;
}

html[data-theme="dark"] .auth-page .simple-modal-close {
    color: #94a3b8;
}

html[data-theme="dark"] .auth-page .modal-tip {
    color: var(--ys-muted);
}

html[data-theme="dark"] .auth-page .modal-alert-danger {
    background: #3a1d22;
    border-color: #5b2b33;
    color: #ff9aa5;
}

html[data-theme="dark"] .auth-page .modal-alert-success {
    background: #12291f;
    border-color: #1e4634;
    color: #7ee2a8;
}

/* ---------------- 注册页特有元素（user/register.php 自绘的一套 class） ---------------- */
html[data-theme="dark"] .auth-page .form-hint {
    color: var(--ys-muted);
}

html[data-theme="dark"] .auth-page .btn-secondary {
    background: #1b2433;
    color: #cbd5e1;
}

html[data-theme="dark"] .auth-page .btn-secondary:hover {
    background: #22304a;
}

html[data-theme="dark"] .auth-page .alert-warning {
    background: #3a2f12;
    border-color: #5a4a1e;
    color: #f0d08a;
}

/* 注册页自带的验证码弹窗（.modal / .modal-content，与 login 的 .simple-modal 不是一套） */
html[data-theme="dark"] .auth-page .modal {
    background: rgba(2, 6, 23, .72);
}

html[data-theme="dark"] .auth-page .modal-content {
    background: #141c2b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

html[data-theme="dark"] .auth-page .modal-header {
    border-bottom-color: #283241;
}

html[data-theme="dark"] .auth-page .modal-header h3 {
    color: #f1f5f9;
}

html[data-theme="dark"] .auth-page .close {
    background: #1f2a3a;
    color: #94a3b8;
}

html[data-theme="dark"] .auth-page .close:hover {
    background: #283548;
}

html[data-theme="dark"] .auth-page .modal-body p {
    color: var(--ys-muted);
}

/* ---------------- 滑块验证码（组件由 JS 注入浅色样式，这里按需覆盖） ---------------- */
html[data-theme="dark"] .cc-slider-track {
    background: #1b2433;
    border-color: #334155;
}

html[data-theme="dark"] .cc-slider-track.is-near {
    background: #1b2433;
    border-color: #2f7d5b;
}

html[data-theme="dark"] .cc-slider-thumb {
    background: #243044;
    border-color: #3b4a63;
}

html[data-theme="dark"] .cc-slider-thumb::before {
    color: #a9b8cc;
}

html[data-theme="dark"] .cc-slider-track.is-near .cc-slider-thumb {
    background: #243044;
    border-color: #2f7d5b;
}

html[data-theme="dark"] .cc-slider-track.is-success .cc-slider-thumb {
    background: #eaf7f0;
    border-color: #d7e6dc;
}

html[data-theme="dark"] .cc-slider-track.is-loading .cc-slider-text {
    color: #8b98ac;
}

/* 原文用灰阶文字渐变，暗色下换成更亮的一档（组件规则带 3 个 :not，需要 !important 稳压） */
html[data-theme="dark"] .cc-slider-track:not(.is-success):not(.is-loading):not(.is-error) .cc-slider-text {
    background-image: linear-gradient(120deg, #93a2b8 0%, #e2e8f0 45%, #93a2b8 70%) !important;
}

/* 登录/注册主按钮：暗色下改为琥珀金（浅色仍为品牌蓝） */
html[data-theme="dark"] .auth-page .btn-submit,
html[data-theme="dark"] .auth-page .btn-code {
    background: #c9922f;
    color: #17181b;
}

html[data-theme="dark"] .auth-page .btn-submit:hover,
html[data-theme="dark"] .auth-page .btn-code:hover:not(:disabled) {
    background: #dba63f;
}

html[data-theme="dark"] .auth-page .loading-spinner {
    border-color: rgba(23, 24, 27, .35);
    border-top-color: #17181b;
}
