/* ============================================================
   程序员工具箱（/devtools）共享样式
   依赖 home.css 的 CSS 变量（--c-*），自动适配黑夜模式
   ============================================================ */

/* ---------- 索引页 ---------- */
.dt-hero {
    position: relative;
    overflow: hidden;
    padding: 72px 0 48px;
    background:
        radial-gradient(900px 480px at 12% -12%, rgba(124, 92, 255, 0.12) 0%, transparent 60%),
        radial-gradient(820px 420px at 88% 0%, rgba(0, 212, 255, 0.10) 0%, transparent 55%),
        linear-gradient(180deg, var(--c-bg) 0%, var(--c-bg-soft) 100%);
    border-bottom: 1px solid var(--c-border);
    text-align: center;
}
[data-theme="dark"] .dt-hero {
    background:
        radial-gradient(900px 480px at 12% -12%, rgba(124, 92, 255, 0.16) 0%, transparent 60%),
        radial-gradient(820px 420px at 88% 0%, rgba(0, 212, 255, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, #0d1117 0%, #111722 100%);
}
.dt-hero h1 {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
    background: linear-gradient(120deg, #0a1a3a 0%, #1a1f36 40%, #7c5cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .dt-hero h1 {
    background: linear-gradient(120deg, #e2e8f0 0%, #a5b4fc 50%, #7c5cff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.dt-hero .lead {
    font-size: 16px;
    color: var(--c-text-sub);
    max-width: 660px;
    margin: 0 auto 30px;
    line-height: 1.75;
}
.dt-hero-stats {
    display: flex;
    justify-content: center;
    gap: 36px;
    flex-wrap: wrap;
}
.dt-hero-stat { text-align: center; }
.dt-hero-stat b {
    display: block;
    font-size: 26px;
    font-weight: 800;
    color: var(--c-text);
}
.dt-hero-stat span { font-size: 13px; color: var(--c-text-muted); }

/* 分类筛选条 */
.dt-filter-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 20px 0 0;
}
.dt-filter-pill {
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-sub);
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    cursor: pointer;
    transition: all .2s ease;
}
.dt-filter-pill:hover { border-color: #d4dbe8; transform: translateY(-1px); }
[data-theme="dark"] .dt-filter-pill:hover { border-color: #3a4556; }
.dt-filter-pill.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.3);
}

.dt-section { padding: 32px 0 80px; }
.dt-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 10px;
}
.dt-count { font-size: 14px; color: var(--c-text-muted); }
.dt-count b { color: var(--c-text); font-weight: 700; }

.dt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.dt-card {
    position: relative;
    display: block;
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    padding: 24px 22px 20px;
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
    text-decoration: none;
    overflow: hidden;
}
.dt-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--icon-bg, var(--c-primary));
    text-decoration: none;
}
.dt-card-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    font-size: 26px;
    border-radius: 14px;
    color: #fff;
    background: var(--icon-bg, var(--c-primary));
    box-shadow: 0 8px 20px var(--icon-shadow, rgba(0, 102, 255, 0.3));
    margin-bottom: 14px;
}
.dt-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
    color: var(--c-text);
}
.dt-card p {
    font-size: 13.5px;
    color: var(--c-text-sub);
    line-height: 1.65;
    margin: 0 0 14px;
}
.dt-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px dashed var(--c-border);
}
.dt-card-meta { font-size: 12px; color: var(--c-text-muted); }
.dt-card-go {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap .2s;
}
.dt-card:hover .dt-card-go { gap: 8px; }

.dt-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: var(--c-text-muted);
}
.dt-empty .emoji { font-size: 40px; margin-bottom: 10px; }

/* 分类徽章 */
.dt-cat-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--c-primary-soft);
    color: var(--c-primary);
}

/* ---------- 工具详情页通用 ---------- */
.dt-detail { padding: 24px 0 60px; }
.dt-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.dt-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}
.dt-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 工具主卡片 */
.dt-card-tool {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}
.dt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.dt-toolbar-left, .dt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dt-status {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 12px;
    display: none;
    line-height: 1.6;
}
.dt-status.show { display: block; }
.dt-status.ok {
    background: rgba(0, 200, 150, 0.10);
    border: 1px solid rgba(0, 200, 150, 0.30);
    color: #0a7d5c;
}
[data-theme="dark"] .dt-status.ok { color: #4ade80; }
.dt-status.err {
    background: rgba(255, 77, 121, 0.10);
    border: 1px solid rgba(255, 77, 121, 0.30);
    color: #d6336c;
}
[data-theme="dark"] .dt-status.err { color: #fb7185; }
.dt-loading { font-size: 13.5px; font-weight: 600; }
.dt-tip { display: inline-block; font-size: 12.5px; color: var(--c-text-muted); line-height: 1.6; }

/* 输入输出面板 */
.dt-editors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.dt-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.dt-pane-head {
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dt-pane-head .count { font-size: 12px; color: var(--c-text-muted); font-weight: 500; }
.dt-textarea {
    width: 100%;
    min-height: 260px;
    resize: vertical;
    padding: 14px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.65;
    font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
    color: var(--c-text);
    background: var(--c-bg-soft);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    box-sizing: border-box;
}
.dt-textarea:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.12);
}
.dt-textarea::placeholder { color: var(--c-text-muted); }
.dt-output-wrap {
    position: relative;
    min-height: 260px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-bg-soft);
    overflow: auto;
}
.dt-output {
    margin: 0;
    padding: 14px;
    font-size: 13.5px;
    line-height: 1.65;
    font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
    color: var(--c-text);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 260px;
    box-sizing: border-box;
}
.dt-output pre, .dt-output code { font-family: inherit; }

/* 单栏工具（无左右分栏时） */
.dt-stack { display: flex; flex-direction: column; gap: 14px; }

/* 表单控件 */
.dt-select, .dt-input {
    padding: 9px 12px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--c-text);
    background: var(--c-bg-card);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.dt-select:focus, .dt-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12);
}
.dt-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-sub);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dt-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--c-text-sub);
    cursor: pointer;
    user-select: none;
}
.dt-check input { accent-color: var(--c-primary); width: 15px; height: 15px; }

/* 小按钮 */
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* 结果统计条 */
.dt-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.dt-stat-chip {
    font-size: 12.5px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    color: var(--c-text-sub);
}
.dt-stat-chip b { color: var(--c-text); }

/* 历史记录 */
.dt-history-card { margin-top: 4px; }
.dt-history-tip { font-size: 12px; color: var(--c-text-muted); font-weight: 500; margin-left: 6px; }
.dt-history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dt-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-bg-card);
    font-size: 13px;
    color: var(--c-text-sub);
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.dt-history-item:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.dt-history-item .time { font-size: 12px; color: var(--c-text-muted); flex-shrink: 0; }
.dt-history-empty { font-size: 13.5px; color: var(--c-text-muted); margin: 10px 0; }

/* ---------- 组件：代码高亮基础 ---------- */
.dt-code-token--key { color: #b0578d; }
.dt-code-token--string { color: #0a8f5e; }
.dt-code-token--number { color: #2c7de0; }
.dt-code-token--bool { color: #c76b1c; }
[data-theme="dark"] .dt-code-token--key { color: #e48cc0; }
[data-theme="dark"] .dt-code-token--string { color: #7ee2a8; }
[data-theme="dark"] .dt-code-token--number { color: #7db7f0; }
[data-theme="dark"] .dt-code-token--bool { color: #f0a870; }

/* ---------- 组件：表格 ---------- */
.dt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    margin-top: 10px;
}
.dt-table th, .dt-table td {
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    text-align: left;
    vertical-align: top;
}
.dt-table th {
    background: var(--c-surface-2);
    font-weight: 700;
    color: var(--c-text);
    white-space: nowrap;
}
.dt-table td { color: var(--c-text-sub); }
.dt-table tr:hover td { background: var(--c-surface-soft); }
.dt-table code {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12.5px;
    background: var(--c-surface-2);
    padding: 2px 6px;
    border-radius: 5px;
    color: var(--c-text);
}

/* ---------- 组件：配置编辑 ---------- */
.dt-fields { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
.dt-field-row {
    display: grid;
    grid-template-columns: 1fr 130px 200px 40px;
    gap: 8px;
    align-items: center;
}
.dt-field-row .row-index { text-align: center; color: var(--c-text-muted); font-size: 12px; }
.dt-field-del {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--c-border);
    border-radius: 9px;
    background: transparent;
    color: var(--c-text-muted);
    cursor: pointer;
    font-size: 15px;
    transition: all .2s;
}
.dt-field-del:hover { color: #fff; background: #ff4d79; border-color: #ff4d79; }
/* CRUD 生成器字段行：序号 / 列名 / 类型 / 备注 / 删除 */
.cg-field-row {
    display: grid;
    grid-template-columns: 34px 1fr 130px 1fr 40px;
    gap: 8px;
    align-items: center;
}
.cg-field-row .f-col, .cg-field-row .f-type, .cg-field-row .f-remark { width: 100%; min-width: 0; }
.dt-add-row {
    align-self: flex-start;
    border: 1px dashed var(--c-border);
    background: transparent;
    color: var(--c-primary);
    padding: 8px 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.dt-add-row:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }

/* ---------- 组件：Tabs 内嵌小导航 ---------- */
.dt-inner-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.dt-inner-tab {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-sub);
    background: var(--c-surface-soft);
    border: 1px solid var(--c-border);
    cursor: pointer;
    transition: all .2s;
}
.dt-inner-tab.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

/* ---------- 组件：命令卡片（Git 速查 / 正则速查） ---------- */
.dt-command-card {
    border: 1px solid var(--c-border);
    border-radius: 14px;
    padding: 18px 20px;
    background: var(--c-bg-card);
    transition: box-shadow .2s, border-color .2s;
}
.dt-command-card:hover { box-shadow: var(--shadow-md); }
.dt-command-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.dt-command-title { font-size: 15px; font-weight: 700; color: var(--c-text); }
.dt-command-desc { font-size: 13px; color: var(--c-text-muted); margin-bottom: 10px; line-height: 1.6; }
.dt-command-code {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #0f172a;
    color: #dbeafe;
    padding: 10px 14px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: nowrap;
}
[data-theme="dark"] .dt-command-code { background: #0b1120; color: #cbd5e1; }
.dt-copy-mini {
    flex-shrink: 0;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 5px 10px;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
    transition: background .2s;
}
.dt-copy-mini:hover { background: rgba(255, 255, 255, 0.25); }

/* ---------- 组件：请求历史 / 收藏 ---------- */
.dt-collect-btn.starred { color: #f59e0b; }

/* ---------- 组件：进制转换行 ---------- */
.dt-conv-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.dt-conv-label {
    flex-shrink: 0;
    width: 92px;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-sub);
    text-align: right;
}

/* ---------- 组件：Mock 数据类型勾选 ---------- */
.md-types {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 6px 0 4px;
}
.md-type-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid var(--c-border);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-sub);
    background: var(--c-bg-card);
    cursor: pointer;
    transition: all .2s;
    user-select: none;
}
.md-type-item input { accent-color: var(--c-primary); width: 15px; height: 15px; }
.md-type-item:hover { border-color: var(--c-primary); }
.md-type-item.active {
    background: var(--c-primary-soft);
    border-color: var(--c-primary);
    color: var(--c-primary);
}

/* ---------- 组件：速查命令卡片（Git / 正则） ---------- */
.gc-section { display: block; }
.gc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--c-bg-card);
    transition: border-color .2s, box-shadow .2s;
    flex-wrap: wrap;
}
.gc-item:hover { border-color: var(--c-primary); box-shadow: var(--shadow-sm); }
.gc-cmd {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12.5px;
    color: var(--c-text);
    background: var(--c-surface-2);
    padding: 4px 10px;
    border-radius: 7px;
    white-space: nowrap;
    overflow-x: auto;
    max-width: 100%;
    flex-shrink: 0;
}
.gc-desc { flex: 1; font-size: 13px; color: var(--c-text-sub); min-width: 120px; }
.gc-copy { flex-shrink: 0; }
.gc-cats { position: sticky; top: 60px; z-index: 5; background: var(--c-bg-card); padding: 8px 0; margin-bottom: 14px; }

/* ---------- 组件：IP 计算结果 ---------- */
.ic-results { display: flex; flex-direction: column; gap: 8px; }
.ic-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-bg-card);
    font-size: 13.5px;
    color: var(--c-text-sub);
    flex-wrap: wrap;
}
.ic-result-row code {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 13px;
    color: var(--c-primary);
    background: var(--c-primary-soft);
    padding: 2px 8px;
    border-radius: 6px;
}

/* ---------- 组件：图片上传区 ---------- */
.ii-drop {
    border: 2px dashed var(--c-border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    transition: all .2s;
    background: var(--c-bg-soft);
}
.ii-drop:hover, .ii-drop.dragging { border-color: var(--c-primary); background: var(--c-primary-soft); }
.ii-drop-icon { font-size: 44px; margin-bottom: 10px; }
.ii-drop-text { font-size: 15px; font-weight: 700; color: var(--c-text); }
.ii-drop-sub { font-size: 12.5px; color: var(--c-text-muted); margin-top: 6px; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
    .dt-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .dt-grid { grid-template-columns: 1fr; }
    .dt-editors { grid-template-columns: 1fr; }
    .dt-field-row { grid-template-columns: 1fr 90px 1fr 36px; }
    .dt-hero h1 { font-size: 30px; }
    .dt-title { font-size: 21px; }
}

/* ============================================================
   办公文职工具箱（/officetools）专属样式
   继承上方 .dt-* 基础样式，hero 改用暖橙渐变与程序员专区区分
   ============================================================ */
.office-hero {
    background:
        radial-gradient(900px 480px at 12% -12%, rgba(251, 146, 60, 0.14) 0%, transparent 60%),
        radial-gradient(820px 420px at 88% 0%, rgba(244, 63, 94, 0.10) 0%, transparent 55%),
        linear-gradient(180deg, var(--c-bg) 0%, var(--c-bg-soft) 100%);
    border-bottom: 1px solid var(--c-border);
}
[data-theme="dark"] .office-hero {
    background:
        radial-gradient(900px 480px at 12% -12%, rgba(251, 146, 60, 0.18) 0%, transparent 60%),
        radial-gradient(820px 420px at 88% 0%, rgba(244, 63, 94, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, #140f0b 0%, #171218 100%);
}
.office-hero h1 {
    background: linear-gradient(120deg, #7c2d12 0%, #ea580c 50%, #db2777 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
[data-theme="dark"] .office-hero h1 {
    background: linear-gradient(120deg, #fde68a 0%, #fb923c 50%, #f472b6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 通用：模板填充 / 抽签 / 重命名等 dt 组件增强（仅补缺，不覆盖已有定义） */
.dt-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-bg-card);
    margin-bottom: 6px;
    font-size: 13.5px;
    color: var(--c-text-sub);
    flex-wrap: wrap;
}
.dt-file-row .k { font-weight: 600; color: var(--c-primary); flex-shrink: 0; }
.dt-file-row .v { min-width: 0; }
