@charset "utf-8";

/* Font definitions */
@font-face {
    font-family: 'Noto Sans SC';
    src: url('/static/fonts/NotoSansSC-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Noto Serif SC';
    src: url('/static/fonts/NotoSerifSC-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'LXGW WenKai';
    src: url('/static/fonts/LXGWWenKai-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-body: #f4f5f7;
    --bg-header: #ffffff;
    --bg-footer: #ffffff;
    --bg-button: #ffffff;
    --bg-button-hover: #f3f4f6;
    --bg-input: #ffffff;
    --bg-nav-title: #f9fafb;
    --bg-main-wrap: transparent;
    --bg-box: #ffffff;
    --bg-tiptitle: #f9fafb;
    --bg-no-comment: #f9fafb;
    --bg-badge: #e5e7eb;
    
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-tertiary: #9ca3af;
    --text-header: #1f2937;
    --text-header-hover: #4b5563;
    --text-input: #1f2937;
    --text-tiptitle: #4b5563;
    --text-nav-title: #111827;
    --text-no-comment: #6b7280;
    --text-red: #ef4444;
    --text-badge: #374151;
    
    --border-color: #e5e7eb;
    --border-button: #d1d5db;
    --border-input: #d1d5db;
    --border-box: #e5e7eb;
    --border-no-comment: #e5e7eb;
    
    --link-color: #2563eb;
    --link-hover: #1d4ed8;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-body: #111827;
    --bg-header: #1f2937;
    --bg-footer: #1f2937;
    --bg-button: #374151;
    --bg-button-hover: #4b5563;
    --bg-input: #374151;
    --bg-nav-title: #1f2937;
    --bg-main-wrap: transparent;
    --bg-box: #1f2937;
    --bg-tiptitle: #374151;
    --bg-no-comment: #374151;
    --bg-badge: #374151;
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-header: #f3f4f6;
    --text-header-hover: #d1d5db;
    --text-input: #f3f4f6;
    --text-tiptitle: #d1d5db;
    --text-nav-title: #f3f4f6;
    --text-no-comment: #9ca3af;
    --text-red: #f87171;
    --text-badge: #d1d5db;
    
    --border-color: #374151;
    --border-button: #4b5563;
    --border-input: #4b5563;
    --border-box: #374151;
    --border-no-comment: #374151;
    
    --link-color: #60a5fa;
    --link-hover: #93c5fd;
}

/* Sepia Theme (护眼模式) */
[data-theme="sepia"] {
    --bg-body: #f4ecd8;
    --bg-header: #fdf6e3;
    --bg-footer: #fdf6e3;
    --bg-button: #fdf6e3;
    --bg-button-hover: #eee8d5;
    --bg-input: #fdf6e3;
    --bg-nav-title: #eee8d5;
    --bg-main-wrap: transparent;
    --bg-box: #fdf6e3;
    --bg-tiptitle: #eee8d5;
    --bg-no-comment: #eee8d5;
    --bg-badge: #d3cbb1;
    
    --text-primary: #5b4636;
    --text-secondary: #837262;
    --text-tertiary: #a69b8f;
    --text-header: #5b4636;
    --text-header-hover: #837262;
    --text-input: #5b4636;
    --text-tiptitle: #5b4636;
    --text-nav-title: #433429;
    --text-no-comment: #837262;
    --text-red: #d33682;
    --text-badge: #433429;
    
    --border-color: #d3cbb1;
    --border-button: #d3cbb1;
    --border-input: #d3cbb1;
    --border-box: #d3cbb1;
    --border-no-comment: #d3cbb1;
    
    --link-color: #268bd2;
    --link-hover: #2aa198;
}

/* Green Theme (护眼模式 - 绿) */
[data-theme="green"] {
    --bg-body: #e8f5e9;
    --bg-header: #c8e6c9;
    --bg-footer: #c8e6c9;
    --bg-button: #c8e6c9;
    --bg-button-hover: #a5d6a7;
    --bg-input: #c8e6c9;
    --bg-nav-title: #a5d6a7;
    --bg-main-wrap: transparent;
    --bg-box: #c8e6c9;
    --bg-tiptitle: #a5d6a7;
    --bg-no-comment: #a5d6a7;
    --bg-badge: #81c784;
    
    --text-primary: #1b5e20;
    --text-secondary: #2e7d32;
    --text-tertiary: #4caf50;
    --text-header: #1b5e20;
    --text-header-hover: #2e7d32;
    --text-input: #1b5e20;
    --text-tiptitle: #1b5e20;
    --text-nav-title: #0d3b10;
    --text-no-comment: #2e7d32;
    --text-red: #c62828;
    --text-badge: #0d3b10;
    
    --border-color: #81c784;
    --border-button: #66bb6a;
    --border-input: #66bb6a;
    --border-box: #81c784;
    --border-no-comment: #81c784;
    
    --link-color: #0d47a1;
    --link-hover: #1565c0;
}

/* Font Classes */
.font-sans {
    font-family: 'Noto Sans SC', system-ui, -apple-system, sans-serif !important;
}

.font-serif {
    font-family: 'Noto Serif SC', 'Times New Roman', serif !important;
}

.font-kaiti {
    font-family: 'LXGW WenKai', 'KaiTi', '楷体', serif !important;
}

/* Settings Dropdown */
.settings-container {
    position: relative;
}

.settings-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    background: var(--bg-box);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 16px;
    z-index: 50;
    margin-top: 8px;
    color: var(--text-primary);
}

.settings-dropdown.active {
    display: block;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.settings-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-option-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-button);
    border-radius: 6px;
    background: var(--bg-button);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-option-btn:hover {
    background: var(--bg-button-hover);
}

.settings-option-btn.active {
    background: var(--text-primary);
    color: var(--bg-body);
    border-color: var(--text-primary);
}

/* Mobile specific overrides */
@media (max-width: 768px) {
    .settings-dropdown {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 80%;
        max-width: 320px;
        right: auto;
        margin-top: 0;
        box-shadow: 0 0 20px rgba(0,0,0,0.3);
        z-index: 1000;
    }
    
    .settings-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .settings-overlay.active {
        display: block;
    }
}

/* Reading Mode */
body.reading-mode .site-header,
body.reading-mode .footer-wrap,
body.reading-mode .main-sider,
body.reading-mode .hdlogo,
body.reading-mode .mobile-top-info,
body.reading-mode .mobile-bottom-info {
    display: none !important;
}

body.reading-mode .main-wrap {
    padding-top: 40px;
    padding-bottom: 40px;
}

body.reading-mode .main-content {
    width: 100% !important;
    max-width: 900px;
    margin: 0 auto;
    float: none;
}

.exit-reading-mode {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    background: var(--bg-box);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.exit-reading-mode:hover {
    transform: scale(1.1);
    background: var(--bg-button-hover);
}

body.reading-mode .exit-reading-mode {
    display: flex !important;
}

/* Theme Utilities */
.theme-hover:hover {
    background-color: var(--bg-button-hover) !important;
}

.theme-active:active {
    background-color: var(--bg-button-hover) !important;
}

.theme-link {
    color: var(--link-color);
}

.theme-link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}
