/* 话术库网页样式 - 多主题完整版 */

/* ========== 主题变量 ========== */

/* 默认护眼模式 */
:root {
    --primary: #a16207;
    --primary-light: #ca8a04;
    --bg-main: #f5f0e1;
    --bg-card: #faf6eb;
    --bg-sidebar: #f0ead8;
    --text-primary: #3d2e0a;
    --text-secondary: #5c4a1f;
    --text-light: #8b7355;
    --border: #e0d5b8;
    --border-light: #ebe4d0;
    --accent-orange: #c2410c;
    --accent-green: #15803d;
    --accent-red: #b91c1c;
    --shadow: 0 1px 3px rgba(93, 74, 31, 0.08);
    --shadow-hover: 0 4px 12px rgba(93, 74, 31, 0.12);
}

/* 明亮模式 */
[data-theme="light"] {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --bg-main: #f5f7fa;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent-orange: #f97316;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 暗色模式 */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --accent-orange: #fb923c;
    --accent-green: #34d399;
    --accent-red: #f87171;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* 护眼模式 - 柔和米黄 */
[data-theme="sepia"] {
    --primary: #a16207;
    --primary-light: #ca8a04;
    --bg-main: #f5f0e1;
    --bg-card: #faf6eb;
    --bg-sidebar: #f0ead8;
    --text-primary: #3d2e0a;
    --text-secondary: #5c4a1f;
    --text-light: #8b7355;
    --border: #e0d5b8;
    --border-light: #ebe4d0;
    --accent-orange: #c2410c;
    --accent-green: #15803d;
    --accent-red: #b91c1c;
    --shadow: 0 1px 3px rgba(93, 74, 31, 0.08);
    --shadow-hover: 0 4px 12px rgba(93, 74, 31, 0.12);
}

/* ========== 基础样式 ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.75;
    font-size: 15px;
    transition: background 0.3s, color 0.3s;
}

/* ========== 右上角主题切换 ========== */

.theme-toggle {
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 300;
    display: flex;
    gap: 5px;
    background: var(--bg-card);
    padding: 5px;
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border);
}

.theme-toggle .theme-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle .theme-btn:hover {
    background: var(--border-light);
}

.theme-toggle .theme-btn.active {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ========== 移动端目录按钮 ========== */

.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ========== 侧边导航栏 ========== */

.sidebar {
    width: 200px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 0;
    padding: 15px 0 0;
    overflow-y: auto;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    padding: 8px 18px 12px;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}

.search-box {
    padding: 10px 12px;
}

.search-box input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box input::placeholder {
    color: var(--text-light);
}

.nav-list {
    list-style: none;
    padding: 5px 0;
}

.nav-list li a {
    display: block;
    padding: 9px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-list li a:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}

.nav-list li a.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* ========== 主内容区 ========== */

.content {
    margin-left: 200px;
    padding: 20px 25px;
    max-width: 100%;
}

.header {
    text-align: center;
    padding: 20px 0 25px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.tips {
    color: var(--text-light);
    font-size: 0.78rem;
    margin-top: 15px;
}

/* ========== 搜索框 ========== */

.search-bar {
    max-width: 500px;
    margin: 18px auto 0;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    z-index: 50;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.search-result-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item mark {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: 1px 3px;
    border-radius: 3px;
}

.search-more,
.search-no-result {
    padding: 10px 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.82rem;
}

/* ========== 板块标题 ========== */

.section {
    margin-bottom: 25px;
    scroll-margin-top: 20px;
}

.section h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 10px 14px;
    background: var(--bg-card);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

/* ========== 卡片样式 ========== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-hover);
}

.card h3 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: color 0.2s;
}

.card h3:hover {
    color: var(--accent-green);
}

.card ul {
    list-style: none;
}

.card ul li {
    padding: 6px 8px 6px 20px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.86rem;
    border-bottom: 1px dashed var(--border-light);
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 4px;
    margin: 2px 0;
}

.card ul li:last-child {
    border-bottom: none;
}

.card ul li::before {
    content: "•";
    position: absolute;
    left: 6px;
    color: var(--primary-light);
}

.card ul li:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.card ul li.copied,
.card ul li.highlight {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

/* 特殊卡片 */
.card.highlight {
    border-left: 3px solid var(--accent-orange);
}

.card.highlight h3 {
    color: var(--accent-orange);
}

.card.urgent {
    border-left: 3px solid var(--accent-red);
}

.card.urgent h3 {
    color: var(--accent-red);
}

/* ========== 提示 ========== */

.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--accent-green);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 页脚 ========== */

.footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    margin-top: 30px;
    color: var(--text-light);
    font-size: 0.82rem;
}

/* ========== 移动端适配 ========== */

@media (max-width: 768px) {
    .theme-toggle {
        top: 10px;
        right: 10px;
        padding: 4px;
    }

    .theme-toggle .theme-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .sidebar {
        position: fixed;
        width: 280px;
        height: 100vh;
        left: -300px;
        top: 0;
        border-right: 1px solid var(--border);
        transition: left 0.3s ease;
        z-index: 200;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .content {
        margin-left: 0;
        padding: 15px 12px 80px;
    }

    .header h1 {
        font-size: 1.25rem;
        margin-top: 40px;
    }

    .search-bar input {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .card {
        padding: 12px 14px;
    }

    .section h2 {
        font-size: 0.95rem;
        padding: 8px 12px;
    }
}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 180px;
    }

    .content {
        margin-left: 180px;
        padding: 18px;
    }
}

/* ========== 滚动条 ========== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ========== 打印 ========== */

@media print {

    .sidebar,
    .theme-toggle,
    .mobile-menu-btn,
    .search-bar,
    .tips {
        display: none !important;
    }

    .content {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    body {
        background: white;
        color: black;
    }
}