/* ============================================================
   Tools Arco Design 官网风格覆盖样式
   参考 https://arco.design/react/docs/start
   
   核心原则：
   - 去掉卡片容器 — 内容直接铺在白色背景上
   - 用标题层级 + 间距分隔内容段落
   - 保持组件的 Arco 风格（输入框、按钮、Tab 等）
    - 配色：品牌标识=TW v4 blue-700，交互色=TW v4 blue-500，
      通过 --dt-* token 层统一管理，品牌域=tw v4 blue oklch 固定档位、对齐 Tailwind v4 slate 中性色
   - DM 设计规范页(design-system.html)自身样式不受影响
   ============================================================ */

/* ===== 工具页面主题 token 层（亮色固定方案） =====
   品牌域=TW v4 blue-700（品牌标识），交互域=TW v4 blue-500（按钮/链接/Tab）。
   中性域=slate（TW v4 固定档位），语义色=tw 档位实色，全套 token 固化。 */
:root {
    /* 表面层级 */
    --dt-bg: #f8fafc;            /* slate-50 页面底色 */
    --dt-raised: #FFFFFF;        /* 卡片/容器抬升层 */
    --dt-overlay: #FFFFFF;       /* 弹窗遮罩层 */
    --dt-inset: #f1f5f9;         /* slate-100 凹陷区域 */
    --dt-fill2: #f1f5f9;         /* slate-100 填充层（输入框底/结果区） */
    /* 品牌域 — Tailwind v4 blue-700 锚点（品牌标识：Logo、品牌卡片边框等） */
    --dt-brand: oklch(0.488 0.243 264.376);              /* blue-700 品牌标识色 */
    --dt-brand-lt: oklch(0.546 0.245 262.881);           /* blue-600 品牌深一档 */
    --dt-brand-bg: oklch(0.424 0.199 265.638);           /* blue-800 品牌底色 */
    --dt-brand-sec: oklch(0.623 0.214 259.815);          /* blue-500 品牌次色 */
    --dt-brand-acc: oklch(0.809 0.105 251.813);          /* blue-300 浅品牌色 */
    --dt-brand-surf: oklch(0.932 0.032 255.585);         /* blue-100 品牌表面色 */
    /* 交互域 — Tailwind v4 blue-500 锚点（按钮/链接/Tab/焦点等交互元素） */
    --dt-interact: oklch(0.623 0.214 259.815);            /* blue-500 交互主色 */
    --dt-interact-lt: oklch(0.707 0.165 254.624);         /* blue-400 交互提亮 */
    --dt-interact-bg: oklch(0.546 0.245 262.881);         /* blue-600 交互底色（实心按钮/hover） */
    --dt-interact-sec: oklch(0.809 0.105 251.813);        /* blue-300 交互次色 */
    --dt-interact-acc: oklch(0.932 0.032 255.585);        /* blue-100 浅交互色 */
    --dt-interact-surf: oklch(0.970 0.014 254.604);       /* blue-50 交互表面色 */
    /* 中性文字 */
    --dt-text1: #0f172a;         /* slate-900 主文字 */
    --dt-text2: #475569;         /* slate-600 次文字 */
    --dt-text3: #64748b;         /* slate-500 辅助文字 */
    --dt-text4: #94a3b8;         /* slate-400 辅助提示 */
    --dt-text5: #cbd5e1;         /* slate-300 占位/禁用文字 */
    --dt-text-inv: #FFFFFF;      /* 反色文字（深底白字） */
    /* 边框 */
    --dt-border: #e2e8f0;        /* slate-200 常规边框 */
    --dt-border-str: #cbd5e1;    /* slate-300 强边框 */
    --dt-card-border: #e2e8f0;   /* 卡片边框 */
    --dt-brand-card-border: oklch(0.488 0.243 264.376);  /* blue-700 品牌卡片边框 */
    /* 语义色 — Tailwind v4 档位实色 */
    --dt-error: #ef4444;         /* red-500 */
    --dt-warning: #f97316;       /* orange-500 */
    --dt-success: #16a34a;       /* green-600（更接近 Arco green-6） */
    --dt-info: #0284c7;          /* sky-600（更接近 Arco arcoblue-6） */
    --dt-error-bg: #fee2e2;      /* red-100 */
    --dt-warning-bg: #ffedd5;    /* orange-100 */
    --dt-success-bg: #dcfce7;    /* green-100 */
    --dt-info-bg: #e0f2fe;       /* sky-100 */
    /* 焦点/选区/骨架/滚动条 */
    --dt-focus: oklch(0.546 0.245 262.881);              /* blue-600 焦点环 */
    --dt-focus-light: oklch(0.623 0.214 259.815 / 0.10);
    --dt-select: #f1f5f9;
    --dt-skeleton-1: #f1f5f9;
    --dt-skeleton-2: #e2e8f0;
    --dt-scrollbar: #cbd5e1;    /* slate-300 同 --dt-text5 */
    /* 交互色透明度梯度（blue-500 oklch + alpha，用于浅底/描边） */
    --dt-interact-a04: oklch(0.623 0.214 259.815 / 0.04);
    --dt-interact-a06: oklch(0.623 0.214 259.815 / 0.06);
    --dt-interact-a12: oklch(0.623 0.214 259.815 / 0.12);
    --dt-interact-a20: oklch(0.623 0.214 259.815 / 0.20);
    --dt-interact-a35: oklch(0.623 0.214 259.815 / 0.35);
}

/* ===== 卡片 — 去掉容器样式，变为透明段落 ===== */
.gc-card {
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: none;
    transition: none;
}

/* Tab 面板切换 — 必须覆盖 gc-card 的 display:flex */
.gc-card.tab-panel {
    display: none;
}

.gc-card.tab-panel.active {
    display: flex;
}

.gc-card:hover {
    border-color: transparent;
    box-shadow: none;
}

/* ===== Tab 导航 — Arco 下划线风格 ===== */
.gc-tab-bar {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid var(--dt-border);
    flex-wrap: nowrap;
    width: 100%;
}

.gc-tab {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 0;
    font-size: 14px;
    line-height: 22px;
    font-weight: 400;
    color: var(--dt-text2);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    white-space: nowrap;
    min-width: 0;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: inherit;
    margin-bottom: -1px;
}

.gc-tab:hover:not(.active) {
    color: var(--dt-interact);
    background: transparent;
    transform: none;
    box-shadow: none;
}

.gc-tab.active,
.gc-tab.active:hover {
    color: var(--dt-interact);
    font-weight: 500;
    border-bottom-color: var(--dt-interact);
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* ===== 页面标题区 — Arco H1 风格 ===== */
.gc-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gc-title {
    font-size: 24px;
    line-height: 32px;
    font-weight: 600;
    color: var(--dt-text1);
    letter-spacing: 0;
}

.gc-subtitle {
    font-size: 14px;
    line-height: 22px;
    color: var(--dt-text3);
    font-family: var(--font-mono);
    font-weight: 400;
    letter-spacing: 0;
}

/* ===== 区块标题 — Arco H2 风格 ===== */
.gc-section-title {
    font-size: 16px;
    line-height: 24px;
    font-weight: 600;
    color: var(--dt-text1);
}

.gc-section-hint {
    font-size: 13px;
    line-height: 20px;
    color: var(--dt-text3);
}

.gc-section-header {
    gap: 2px;
}

/* ===== 输入框 — Arco Input 风格 ===== */
.gc-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 200px;
    height: 32px;
    padding: 0 12px;
    background: var(--dt-raised);
    border: 1px solid var(--dt-border);
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.gc-input-wrap:focus-within {
    border-color: var(--dt-interact);
    box-shadow: 0 0 0 2px var(--dt-focus-light);
}

.gc-input-hash,
.gc-input-unit {
    font-size: 13px;
    line-height: 18px;
    color: var(--dt-text3);
    user-select: none;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.gc-input-field {
    flex: 1;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--dt-text1);
    font-size: 14px;
    line-height: 22px;
    font-family: var(--font-mono);
    outline: none;
    text-align: left;
    letter-spacing: 0;
}

.gc-input-preview-lg {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.gc-input-label {
    font-size: 14px;
    line-height: 22px;
    color: var(--dt-text1);
    text-align: left;
    margin-bottom: 8px;
    white-space: nowrap;
    font-weight: 400;
}

.gc-input-note {
    font-size: 12px;
    line-height: 18px;
    color: var(--dt-text3);
    margin-top: 4px;
    text-align: left;
    white-space: nowrap;
}

/* ===== 旧版输入框兼容 ===== */
.gc-input-wrap .gc-input {
    width: auto;
    flex: 1;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--dt-text1);
    font-size: 14px;
    line-height: 22px;
    font-family: var(--font-mono);
    outline: none;
    text-align: left;
    -moz-appearance: textfield;
    box-sizing: border-box;
}

/* ===== 输入组 ===== */
.gc-inputs-row {
    gap: 16px;
}

.gc-input-group {
    width: 200px;
}

/* ===== 计算结果 — 浅底区分 ===== */
.gc-result-item {
    background: var(--dt-fill2);
    border-radius: 4px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 80px;
    flex-shrink: 0;
    border: none;
}

.gc-result-item .gc-result-value {
    font-size: 14px;
    line-height: 22px;
    color: var(--dt-text1);
    font-weight: 600;
    font-family: var(--font-mono);
}

.gc-result-item .gc-result-label {
    font-size: 12px;
    line-height: 18px;
    color: var(--dt-text3);
    margin-top: 2px;
}

/* ===== 结果卡片（色板专用）— 浅底紧凑 ===== */
.gc-result-card {
    width: 100px;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    background: var(--dt-fill2);
    border-radius: 4px;
    padding: 10px 12px 12px;
    flex-shrink: 0;
    border: none;
}

.gc-result-card.accent {
    background: var(--dt-interact-a04);
}

/* ===== Toast — Arco Message 风格 ===== */
.cp-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dt-text1);
    color: var(--dt-text-inv);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.cp-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Tooltip — 全局浮动层（Arco Tooltip 风格） ===== */
.gc-swatch-tip {
    position: fixed;
    background: var(--dt-text1);
    color: var(--dt-text-inv);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: var(--font-mono);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 12px;
}
.gc-swatch-tip.visible {
    opacity: 1;
}

.gc-swatch-tip .tooltip-shade {
    font-size: 11px;
    line-height: 16px;
    color: rgba(255,255,255,0.6);
    font-weight: 400;
}

.gc-swatch-tip .tooltip-oklch {
    font-size: 11px;
    line-height: 15px;
    color: rgba(255,255,255,0.75);
    font-weight: 400;
}

.gc-swatch-tip .tooltip-hex {
    font-size: 13px;
    line-height: 18px;
    color: var(--dt-text-inv);
    font-weight: 600;
}

/* ===== 色块 ===== */
.tw-color-swatch {
    border-radius: 4px;
}

.tw-color-swatch:hover {
    transform: scale(1.04);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

.cp-hue-cell {
    border-radius: 4px;
}

.cp-hue-cell:hover {
    transform: scale(1.04);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 20;
}

/* ===== 色板表格间距 ===== */
.tw-palette-table {
    gap: 4px;
}

.tw-color-row {
    gap: 4px;
}

.tw-color-name {
    font-size: 14px;
    line-height: 22px;
    height: 32px;
    border-radius: 4px;
    padding-right: 8px;
    width: 72px;
    color: var(--dt-text2);
    font-weight: 600;
    overflow: hidden;
}

.tw-palette-header-name {
    width: 72px;
}

.tw-palette-shade-label {
    font-size: 12px;
    border-radius: 4px;
    color: var(--dt-text3);
}

.tw-color-swatch,
.cp-hue-cell {
    height: 32px;
    border-radius: 4px;
}

.tw-color-swatches {
    gap: 3px;
}

.tw-palette-header-shades {
    gap: 3px;
}

/* ===== 栅格预览 ===== */
.gc-col-bar {
    background: var(--dt-interact-a06);
    border: 1px solid var(--dt-interact-a20);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    margin: 8px 0;
    overflow: hidden;
    min-height: 48px;
}

.gc-col-bar:hover {
    background: var(--dt-focus-light);
    border-color: var(--dt-interact-a35);
}

.gc-margin-bar:first-child {
    border-right: 1px dashed rgba(255, 105, 0, 0.4);
}

.gc-margin-bar:last-child {
    border-left: 1px dashed rgba(255, 105, 0, 0.4);
}

.gc-col-num {
    font-size: 13px;
    line-height: 22px;
    color: var(--dt-text1);
    font-weight: 600;
}

.gc-grid-preview {
    margin-top: 8px;
}

/* ===== 底部备案 ===== */
.page-footer {
    display: flex;
    gap: 16px;
    padding-top: 4px;
    border-top: 1px solid var(--dt-border);
    margin-top: auto;
    margin-bottom: -32px;
    width: 100%;
}

.page-footer span,
.page-footer a {
    font-size: 12px;
    font-weight: 400;
    line-height: 18px;
    color: var(--dt-text3);
    text-decoration: none;
}

.page-footer a:hover {
    color: var(--dt-interact);
}

/* ===== APCA 输入组 — Arco Input 风格 ===== */
.apca-input-box {
    width: 200px;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: var(--dt-raised);
    border: 1px solid var(--dt-border);
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.apca-input-box:focus-within {
    border-color: var(--dt-interact);
    box-shadow: 0 0 0 2px var(--dt-focus-light);
}

.apca-preview-lg {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid transparent;
    flex-shrink: 0;
}

/* ===== 评级弹窗 — Arco Popover 风格 ===== */
.apca-rating-card .cp-lc-popup {
    background: var(--dt-text1);
    border-radius: 4px;
    padding: 10px;
    width: min(320px, calc(100vw - 64px));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.apca-rating-card .cp-lc-popup::after {
    border-top-color: var(--dt-text1);
}

/* ===== 标题标签 — Arco Tag 风格 ===== */
.gc-title-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--dt-interact);
    background: var(--dt-interact-a06);
    border: 1px solid var(--dt-interact-a12);
    border-radius: 2px;
    padding: 2px 6px;
    line-height: 18px;
}
