/* 工具箱页面通用样式 */
.tools-page {
    padding-bottom: 60px;
}

.tools-page .navbar {
    z-index: 1030;
}

.tools-sidebar {
    background: var(--bs-tertiary-bg, #f8fafc);
    min-height: calc(100vh - 56px);
    border-right: 1px solid var(--bs-border-color, #e2e8f0);
}

.tools-sidebar .sticky-top {
    top: 56px;
    z-index: 1010;
}

.tools-nav-title {
    font-weight: 600;
    color: var(--bs-secondary-color, #64748b);
    padding: 0 12px;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.tools-nav .list-group-item {
    border: none;
    background: transparent;
    color: var(--bs-body-color, #334155);
    border-radius: 8px;
    margin-bottom: 2px;
    padding: 10px 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools-nav .list-group-item i {
    width: 20px;
    text-align: center;
    color: #3b82f6;
    font-size: 0.9rem;
}

.tools-nav .list-group-item:hover {
    background: var(--bs-secondary-bg, #e2e8f0);
}

.tools-nav .list-group-item.active {
    background: #3b82f6;
    color: #fff;
}

.tools-nav .list-group-item.active i {
    color: #fff;
}

.tools-content {
    padding: 24px;
}

.tool-section {
    margin-bottom: 40px;
    scroll-margin-top: 70px;
}

.tool-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--bs-border-color, #e2e8f0);
    color: var(--bs-body-color, #334155);
}

.tool-title i {
    color: #3b82f6;
}

.tool-panel {
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #e2e8f0);
    border-radius: 12px;
    padding: 20px;
}

/* 待办清单 */
.todo-list {
    max-height: 320px;
    overflow-y: auto;
}

.todo-list .list-group-item {
    border-radius: 8px;
    margin-bottom: 4px;
    border: 1px solid var(--bs-border-color, #e2e8f0);
}

.todo-done .todo-text {
    text-decoration: line-through;
    opacity: 0.6;
}

/* 计算器 */
.calculator {
    max-width: 320px;
    margin: 0 auto;
}

.calc-display {
    background: var(--bs-tertiary-bg, #f1f5f9);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    text-align: right;
}

.calc-history {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #94a3b8);
    min-height: 20px;
}

.calc-current {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--bs-body-color, #334155);
    word-break: break-all;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.calc-btn {
    border: none;
    border-radius: 8px;
    padding: 14px 0;
    font-size: 1.1rem;
    cursor: pointer;
    background: var(--bs-tertiary-bg, #f1f5f9);
    color: var(--bs-body-color, #334155);
    transition: all 0.15s;
}

.calc-btn:hover {
    background: var(--bs-secondary-bg, #e2e8f0);
}

.calc-btn.calc-op {
    background: #dbeafe;
    color: #3b82f6;
}

.calc-btn.calc-op:hover {
    background: #bfdbfe;
}

.calc-btn.calc-fn {
    background: #fee2e2;
    color: #ef4444;
}

.calc-btn.calc-fn:hover {
    background: #fecaca;
}

.calc-btn.calc-eq {
    background: #3b82f6;
    color: #fff;
    grid-column: span 2;
}

.calc-btn.calc-eq:hover {
    background: #2563eb;
}

/* Markdown 预览 */
.markdown-preview {
    overflow-y: auto;
    max-height: 400px;
}

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-preview pre {
    background: var(--bs-tertiary-bg, #f1f5f9);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
}

.markdown-preview code {
    background: var(--bs-tertiary-bg, #f1f5f9);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-preview blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 12px;
    margin-left: 0;
    color: var(--bs-secondary-color, #64748b);
}

/* 颜色预览 */
.color-preview-box {
    transition: background 0.2s;
}

/* 二维码 */
.qr-result-area img {
    max-width: 100%;
    height: auto;
}

/* 随机抽签 */
.random-result {
    background: var(--bs-tertiary-bg, #f1f5f9);
    border-radius: 12px;
}

/* 夜间模式 */
[data-bs-theme="dark"] .tools-sidebar {
    background: #1e1e1e;
    border-color: #333;
}

[data-bs-theme="dark"] .tools-nav .list-group-item {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .tools-nav .list-group-item:hover {
    background: #2d2d2d;
}

[data-bs-theme="dark"] .tool-title {
    border-color: #333;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .tool-panel {
    background: #1e1e1e;
    border-color: #333;
}

[data-bs-theme="dark"] .calc-display {
    background: #2d2d2d;
}

[data-bs-theme="dark"] .calc-current {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .calc-btn {
    background: #2d2d2d;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .calc-btn:hover {
    background: #3a3a3a;
}

[data-bs-theme="dark"] .markdown-preview pre,
[data-bs-theme="dark"] .markdown-preview code {
    background: #2d2d2d;
}

[data-bs-theme="dark"] .random-result {
    background: #2d2d2d;
}

/* 移动端适配 */
@media (max-width: 767px) {
    .tools-sidebar {
        display: none;
    }

    .tools-content {
        padding: 16px;
    }

    .tool-section {
        scroll-margin-top: 60px;
    }
}
