/* KuGua 深色主题 — html 根节点需有 data-theme="dark" */

html[data-theme="dark"] {
    color-scheme: dark;
    --primary-color: #e2e8f0;
    --secondary-color: #94a3b8;
    --muted-color: #94a3b8;
    --placeholder-color: #64748b;
    --sidebar-text: #cbd5e1;
    --accent-color: #818cf8;
    --hover-color: #a78bfa;
    --glass-bg: rgba(30, 41, 59, 0.72);
    --glass-bg-solid: rgba(15, 23, 42, 0.96);
    --glass-border: rgba(148, 163, 184, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --focus-ring: 0 0 0 3px rgba(129, 140, 248, 0.35);
    --bg-color: #0f172a;
}

html[data-theme="dark"] body {
    background: linear-gradient(135deg, #0b1120 0%, #1e293b 48%, #0f172a 100%) !important;
    color: var(--primary-color);
}

html[data-theme="dark"] body.admin-layout {
    background: #0f172a !important;
}

/* 入口页 */
html[data-theme="dark"] .welcome-box {
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

html[data-theme="dark"] .btn {
    background: rgba(30, 41, 59, 0.65);
    border-color: rgba(148, 163, 184, 0.25);
    color: var(--secondary-color);
}

html[data-theme="dark"] .btn:hover {
    background: rgba(51, 65, 85, 0.85);
    border-color: rgba(129, 140, 248, 0.35);
    color: var(--accent-color);
}

/* 导航与侧栏 */
html[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.88);
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .sidebar {
    background: var(--glass-bg-solid);
    border-right-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .sidebar-link:hover,
html[data-theme="dark"] .sidebar-link.active {
    background: rgba(129, 140, 248, 0.12);
}

html[data-theme="dark"] .login-btn-corner,
html[data-theme="dark"] .nav-logout-btn {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(148, 163, 184, 0.28);
    color: #c7d2fe;
}

html[data-theme="dark"] .nav-logout-btn:hover {
    background: rgba(51, 65, 85, 0.95);
    border-color: rgba(129, 140, 248, 0.45);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .theme-toggle-btn {
    background: linear-gradient(145deg, rgba(51, 65, 85, 0.95), rgba(30, 41, 59, 0.88));
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .sidebar-theme-btn {
    background: rgba(51, 65, 85, 0.85);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] body.admin-layout .sidebar-theme-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
}

/* 内容卡片 */
html[data-theme="dark"] .article-card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .message-item,
html[data-theme="dark"] .guestbook-form,
html[data-theme="dark"] .contact-item,
html[data-theme="dark"] .about-content,
html[data-theme="dark"] .content .article-header,
html[data-theme="dark"] .article-body,
html[data-theme="dark"] .pagination,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .article-toc,
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .project-detail-card {
    background: rgba(30, 41, 59, 0.78) !important;
    border-color: rgba(148, 163, 184, 0.18) !important;
}

html[data-theme="dark"] .article-toc-link:hover {
    background: rgba(129, 140, 248, 0.12);
}

/* 表单 */
html[data-theme="dark"] .guestbook-form input,
html[data-theme="dark"] .guestbook-form textarea,
html[data-theme="dark"] .login-form input,
html[data-theme="dark"] .filter-bar select,
html[data-theme="dark"] .filter-bar input {
    background: rgba(15, 23, 42, 0.85) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #f1f5f9;
}

html[data-theme="dark"] .message-like-btn {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.22);
    color: #94a3b8;
}

html[data-theme="dark"] .message-like-btn:hover:not(:disabled),
html[data-theme="dark"] .message-like-btn.is-liked {
    color: #fb7185;
    border-color: rgba(251, 113, 133, 0.45);
    background: rgba(251, 113, 133, 0.12);
}

html[data-theme="dark"] .page-home .section-header-row {
    border-bottom-color: rgba(129, 140, 248, 0.65);
}

html[data-theme="dark"] .page-home .hero-btn-secondary {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(129, 140, 248, 0.35);
    color: #a5b4fc;
}

html[data-theme="dark"] .page-home .hero-btn-secondary:hover {
    background: rgba(129, 140, 248, 0.12);
}

html[data-theme="dark"] .page-home .contact-section .contact-info {
    background: rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] .site-footer {
    border-top-color: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

html[data-theme="dark"] .site-footer-top {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(129, 140, 248, 0.25);
    color: #cbd5e1;
}

html[data-theme="dark"] .kugua-load-tip {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(129, 140, 248, 0.25);
    color: #cbd5e1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .kugua-load-bar {
    background: rgba(129, 140, 248, 0.15);
}

html[data-theme="dark"] .kugua-skel-line,
html[data-theme="dark"] .kugua-skel-rank,
html[data-theme="dark"] .kugua-skel-avatar,
html[data-theme="dark"] .kugua-skel-icon {
    background: linear-gradient(90deg, rgba(51, 65, 85, 0.55) 0%, rgba(71, 85, 105, 0.75) 50%, rgba(51, 65, 85, 0.55) 100%);
    background-size: 200% 100%;
}

html[data-theme="dark"] .kugua-skel-card,
html[data-theme="dark"] .kugua-skel-list-item,
html[data-theme="dark"] .kugua-skel-message,
html[data-theme="dark"] .kugua-skel-contact,
html[data-theme="dark"] .kugua-skel-viewer,
html[data-theme="dark"] .kugua-skel-admin-card,
html[data-theme="dark"] .kugua-skel-stat,
html[data-theme="dark"] .kugua-skel-activity-item {
    background: rgba(15, 23, 42, 0.55);
    border-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .admin-reply-block {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(129, 140, 248, 0.25);
}

/* 后台 */
html[data-theme="dark"] .admin-sidebar {
    background: #0f172a;
    border-right-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .admin-main {
    background: #0f172a;
}

html[data-theme="dark"] .admin-header {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .message-card,
html[data-theme="dark"] .admin-card,
html[data-theme="dark"] .audit-log-item {
    background: #1e293b !important;
    border-color: rgba(148, 163, 184, 0.15) !important;
    color: #e2e8f0;
}

html[data-theme="dark"] .data-table th {
    background: rgba(15, 23, 42, 0.6);
    color: #cbd5e1;
}

html[data-theme="dark"] .data-table tr:hover td {
    background: rgba(51, 65, 85, 0.4);
}

html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.25);
    color: #f1f5f9;
}

html[data-theme="dark"] .backup-reminder {
    background: rgba(120, 53, 15, 0.35);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fde68a;
}

/* 列表页工具栏 */
html[data-theme="dark"] .list-toolbar {
    background: rgba(30, 41, 59, 0.72);
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .filter-label {
    color: #94a3b8;
}

html[data-theme="dark"] .filter-select,
html[data-theme="dark"] #searchInput,
html[data-theme="dark"] .search-input {
    background: rgba(15, 23, 42, 0.88) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #f1f5f9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23818cf8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] .back-link {
    color: #94a3b8;
}

html[data-theme="dark"] .back-link:hover {
    color: #c7d2fe;
}

html[data-theme="dark"] .articles-list .article-card,
html[data-theme="dark"] .projects-grid .project-card {
    background: rgba(30, 41, 59, 0.78) !important;
    border-color: rgba(148, 163, 184, 0.16) !important;
}

html[data-theme="dark"] .articles-list .article-card:hover,
html[data-theme="dark"] .projects-grid .project-card:hover {
    border-color: rgba(129, 140, 248, 0.35) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .list-pagination .pagination,
html[data-theme="dark"] .pagination {
    background: rgba(30, 41, 59, 0.72);
    border-color: rgba(148, 163, 184, 0.18);
}

/* 档案演示页 */
html[data-theme="dark"] body.demo-page {
    background: linear-gradient(135deg, #0b1120 0%, #1e293b 48%, #0f172a 100%) !important;
}

html[data-theme="dark"] .demo-login-wrap,
html[data-theme="dark"] .demo-topbar,
html[data-theme="dark"] .demo-table-wrap,
html[data-theme="dark"] .demo-pagination,
html[data-theme="dark"] .archive-card {
    background: rgba(30, 41, 59, 0.88) !important;
    border-color: rgba(148, 163, 184, 0.16);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .demo-login-hint,
html[data-theme="dark"] .demo-mode-hint,
html[data-theme="dark"] .demo-total-info,
html[data-theme="dark"] .demo-empty,
html[data-theme="dark"] .demo-pagination-info,
html[data-theme="dark"] .demo-pagination-info-only {
    color: #94a3b8;
}

html[data-theme="dark"] .demo-field label {
    color: #cbd5e1;
}

html[data-theme="dark"] .demo-field input,
html[data-theme="dark"] .demo-field select,
html[data-theme="dark"] .demo-toolbar input,
html[data-theme="dark"] .demo-toolbar select,
html[data-theme="dark"] .demo-addr-group select,
html[data-theme="dark"] .demo-addr-group .addr-filter-select,
html[data-theme="dark"] .demo-form input,
html[data-theme="dark"] .demo-form select,
html[data-theme="dark"] .demo-form textarea {
    background: rgba(15, 23, 42, 0.88) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: #f1f5f9;
}

html[data-theme="dark"] .demo-table-wrap td {
    color: #e2e8f0;
    border-bottom-color: rgba(148, 163, 184, 0.12);
}

html[data-theme="dark"] .demo-table-wrap tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] .demo-table-wrap tbody tr:hover {
    background: rgba(51, 65, 85, 0.55);
}

html[data-theme="dark"] .archive-card h4 {
    color: #f1f5f9;
}

html[data-theme="dark"] .archive-card p {
    color: #94a3b8;
}

html[data-theme="dark"] .card-actions {
    border-top-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .demo-pagination-nav {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

html[data-theme="dark"] .demo-modal-box,
html[data-theme="dark"] .demo-modal-content {
    background: #1e293b !important;
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .addr-modal-header {
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.9), rgba(30, 41, 59, 0.85));
    border-bottom-color: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .addr-modal-header h3,
html[data-theme="dark"] .addr-manager-hint {
    color: #e2e8f0;
}

html[data-theme="dark"] .addr-manager-hint {
    color: #94a3b8;
}

html[data-theme="dark"] .demo-chip-back {
    background: rgba(129, 140, 248, 0.12);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.28);
}

html[data-theme="dark"] .demo-chip-logout {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.32);
}

html[data-theme="dark"] .drag-handle {
    background: rgba(129, 140, 248, 0.15);
    color: #c7d2fe;
}

html[data-theme="dark"] .addr-manager-item {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .addr-manager-item.is-editing {
    background: linear-gradient(90deg, rgba(120, 53, 15, 0.35), rgba(30, 41, 59, 0.9));
    border-color: rgba(251, 191, 36, 0.35);
}

html[data-theme="dark"] .addr-manager-info strong {
    color: #f1f5f9;
}

html[data-theme="dark"] .addr-count-badge {
    background: rgba(51, 65, 85, 0.8);
    color: #94a3b8;
}

html[data-theme="dark"] .addr-form-row input {
    background: rgba(15, 23, 42, 0.88);
    border-color: rgba(148, 163, 184, 0.25);
    color: #f1f5f9;
}
