/* 主题变量与基础重置 */
:root {
    --bg: #0b0f19;
    --bg-elev: #111726;
    --text: #e6e8ee;
    --muted: #a7adbd;
    --primary: #6aa2ff;
    --primary-600: #4c8dff;
    --border: #1b2336;
    --card: #0f1422;
    --success: #22c55e;
    --warn: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* 明亮主题 */
.theme-light {
    --bg: #f7f8fb;
    --bg-elev: #ffffff;
    --text: #0b1030;
    --muted: #5b647a;
    --primary: #3b82f6;
    --primary-600: #2563eb;
    --border: #e7eaf3;
    --card: #ffffff;
    --shadow: 0 10px 24px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: ui-sans-serif, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", "Noto Sans CJK SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app { display: flex; flex-direction: column; min-height: 100%; }

/* Header */
.app-header {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px;
    height: 64px; padding: 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { font-size: 20px; }
.brand-title { font-weight: 700; letter-spacing: .2px; }

.search-wrap { flex: 1; display: flex; }
.search-input {
    width: 100%;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--text);
    padding: 0 14px;
    outline: none;
}
.search-input::placeholder { color: var(--muted); }

.actions { display: inline-flex; align-items: center; gap: 8px; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--bg-elev); color: var(--text);
    border: 1px solid var(--border); cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

.sidebar-toggle { display: none; }

/* Layout */
.app-body { display: grid; grid-template-columns: 260px 1fr; gap: 0; }

.app-sidebar {
    position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px);
    border-right: 1px solid var(--border);
    background: var(--bg);
    padding: 16px 12px; overflow: auto;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 16px; }
.sidebar-title { font-size: 12px; color: var(--muted); margin: 8px 8px; text-transform: uppercase; letter-spacing: .6px; }
.chip { cursor: pointer; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.sidebar-section ul { margin: 0; padding: 4px; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.sidebar-footer { color: var(--muted); padding: 8px; }

.app-main { padding: 24px; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.tool-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title { margin: 0; font-size: 16px; }
.card-desc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.card-actions { margin-top: 8px; }

.btn { height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--text); cursor: pointer; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }

.fav-btn { border: 1px solid var(--border); background: var(--bg-elev); color: var(--muted); border-radius: 8px; height: 28px; padding: 0 10px; cursor: pointer; }
.fav-btn.active { color: var(--warn); border-color: var(--warn); }

.app-footer { border-top: 1px solid var(--border); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.footer-links a { color: var(--muted); text-decoration: none; margin-left: 12px; }
.footer-links a:hover { color: var(--text); }

/* 详情抽屉与遮罩 */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.overlay.show { opacity: 1; pointer-events: auto; }

.detail-drawer { position: fixed; top: 64px; right: 0; height: calc(100vh - 64px); width: min(520px, 92vw); background: var(--bg-elev); border-left: 1px solid var(--border); box-shadow: var(--shadow); transform: translateX(100%); transition: transform .25s ease; display: flex; flex-direction: column; }
.detail-drawer.show { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px; border-bottom: 1px solid var(--border); }
.drawer-title { margin: 0; font-size: 18px; }
.drawer-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.drawer-desc { color: var(--muted); margin: 0; }
.drawer-meta { color: var(--muted); font-size: 13px; }
.drawer-actions { margin-top: 8px; }
.drawer-loading { font-size: 13px; color: var(--muted); }
.drawer-iframe { width: 100%; height: 360px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }

/* 响应式 */
@media (max-width: 1200px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 840px) {
    .app-body { grid-template-columns: 1fr; }
    .app-sidebar { position: fixed; left: 0; top: 64px; width: 260px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow); }
    .app-sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: inline-flex; }
    .grid { grid-template-columns: 1fr; }
}


