/* ===== 通用工具样式基座（文本转换 / 生成器 / 计算器 / 时间工具共用） =====
   本文件只提供「骨架 + 通用控件」，各工具的特有样式写在各自模板的 <style> 里。
   类名前缀统一 cv- ，避免与其它工具 CSS 冲突。 */

/* ---------- 左右两栏骨架 ---------- */
.convert-grid { margin: 0 !important; }
.convert-grid > div { padding: 0 20px 20px 20px !important; box-sizing: border-box; }
.convert-grid > div:first-child { border-right: 1px solid var(--border); }
.section-title {
    font-size: 16px; font-weight: 600; line-height: 50px;
    display: flex; gap: 5px; align-items: center; min-width: 0;
}
.section-title i { color: var(--link); }
.section-title .cv-hint-inline { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.section-title .cv-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- 文本域 / 输入框 / 下拉 ---------- */
/* ⚠️ 必须用 .editor-row .cv-textarea (0,2,0) 压过 tool.css 的 .editor-row textarea (0,1,1) */
.editor-row .cv-textarea {
    width: 100%; box-sizing: border-box; height: 260px; padding: 12px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px; line-height: 1.75;
    color: var(--editor-text); background: var(--editor-bg);
    border: 1px solid var(--editor-border); border-radius: 6px;
    resize: vertical; display: block;
}
.editor-row .cv-textarea::placeholder { color: var(--muted); opacity: 1; }
.editor-row .cv-textarea:focus { outline: none; border-color: var(--link); }
.editor-row .cv-textarea.readonly { color: var(--editor-text); cursor: default; }
.editor-row .cv-textarea.sm { height: 130px; }

.editor-row .cv-input {
    width: 100%; min-width: 0; box-sizing: border-box;
    padding: 7px 10px; font-size: 13px; line-height: 1.7;
    color: var(--editor-text); background: var(--editor-bg);
    border: 1px solid var(--editor-border); border-radius: 5px;
}
.editor-row .cv-input:focus { outline: none; border-color: var(--link); }
.editor-row .cv-input::placeholder { color: var(--muted); opacity: 1; }
.editor-row .cv-input.bad { border-color: #dc2626; }
.editor-row .cv-input.mono { font-family: Consolas, Monaco, "Courier New", monospace; }

/* ⚠️ select 必须去掉原生外观，否则长选项文字会被原生箭头盖住 */
.editor-row .cv-select {
    width: 100%; box-sizing: border-box;
    padding: 7px 24px 7px 10px; font-size: 13px; line-height: 1.7;
    border: 1px solid var(--editor-border); border-radius: 5px;
    background-color: var(--editor-bg); color: var(--editor-text); cursor: pointer;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%23888888' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center; background-size: 11px 11px;
    text-overflow: ellipsis;
}
.editor-row .cv-select:focus { outline: none; border-color: var(--link); }
.editor-row .cv-select:disabled { background-color: var(--panel-head-bg); color: var(--muted); cursor: not-allowed; opacity: .75; }

/* ---------- 参数行（左标签右控件） ---------- */
.cv-params { display: flex; flex-direction: column; gap: 11px; margin-top: 6px; }
.cv-prow { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: 10px; }
.cv-prow > label {
    font-size: 13px; font-weight: 600; color: var(--text);
    line-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cv-pfield { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cv-kv { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
.cv-kv > .cv-input, .cv-kv > .cv-select { flex: 1 1 140px; min-width: 0; }
.cv-kv.two > * { flex: 1 1 0; min-width: 0; }
.cv-kv.two > .cv-input { flex: 1 1 0; }

.cv-hint { font-size: 12px; line-height: 1.6; color: var(--muted); }
.cv-hint.ok { color: #0d9e6c; }
.cv-hint.bad { color: #c0392b; }
.cv-hint code { font-family: Consolas, Monaco, monospace; }

/* ---------- 芯片 / 段控件 / 复选 ---------- */
.cv-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cv-chip {
    padding: 4px 10px; font-size: 12px; line-height: 1.7;
    border: 1px dashed var(--editor-border); border-radius: 12px;
    background: transparent; color: var(--muted); cursor: pointer; transition: all .15s;
}
.cv-chip:hover { border-style: solid; color: var(--link); border-color: var(--link); }
.cv-chip.on { border-style: solid; color: var(--link); border-color: var(--link); background: rgba(70,132,255,.08); font-weight: 600; }

.cv-seg { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--editor-border); border-radius: 5px; overflow: hidden; }
.cv-seg-btn {
    padding: 7px 11px; font-size: 12.5px; line-height: 1.7;
    border: none; background: var(--editor-bg); color: var(--muted); cursor: pointer; transition: all .15s;
}
.cv-seg-btn + .cv-seg-btn { border-left: 1px solid var(--editor-border); }
.cv-seg-btn:hover { color: var(--link); }
.cv-seg-btn.on { background: var(--link); color: #fff; font-weight: 600; }

.cv-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.cv-check input { width: 15px; height: 15px; accent-color: var(--link); cursor: pointer; }

/* ---------- 按钮行 ---------- */
.cv-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.cv-tools .tbtn { margin: 0; }
.cv-tools-right { margin-left: auto; font-size: 12px; color: var(--muted); }

.cv-icon-btn {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 10px; font-size: 12.5px; line-height: 1.7;
    border: 1px solid var(--editor-border); border-radius: 5px;
    background: var(--panel-bg); color: var(--muted); cursor: pointer; transition: all .15s;
}
.cv-icon-btn:hover { color: var(--link); border-color: var(--link); }
.cv-icon-btn:disabled { opacity: .45; cursor: not-allowed; color: var(--muted); border-color: var(--editor-border); }

/* ---------- 结果区 ---------- */
#outputCol { display: flex; flex-direction: column; }
#outputCol > .section-title { flex: 0 0 auto; }
.cv-result { flex: 1 1 auto; min-height: 260px; max-height: 505px; overflow-y: auto; }

.cv-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; height: 100%; min-height: 240px;
    color: var(--muted); font-size: 13px; text-align: center;
}
.cv-empty > i { font-size: 30px; opacity: .5; }

.cv-label {
    display: flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; color: var(--muted);
    margin-bottom: 6px; letter-spacing: .03em;
}
.cv-field { margin-bottom: 14px; }

.cv-out {
    display: block; padding: 12px; min-height: 56px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13.5px; line-height: 1.85; word-break: break-all;
    color: var(--editor-text); background: var(--editor-bg);
    border: 1px solid var(--editor-border); border-radius: 6px;
    cursor: pointer; transition: border-color .15s;
}
.cv-out:hover { border-color: var(--link); }
.cv-out.plain { font-family: inherit; font-size: 14px; white-space: pre-wrap; }
.cv-out.hl { color: var(--hl-tpl); }

.cv-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.cv-meta b { color: var(--text); font-weight: 600; margin-right: 3px; }

.cv-status {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 12px; margin-bottom: 14px; border-radius: 6px; font-size: 13px;
}
.cv-status.ok { background: rgba(40,167,69,.1); color: #0d9e6c; }
.cv-status.warn { background: rgba(243,156,18,.12); color: #d68910; }
.cv-status.err { background: rgba(231,76,60,.1); color: #c0392b; }
.cv-status.busy { background: rgba(70,132,255,.1); color: var(--link); }

@keyframes cv-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.cv-spin { display: inline-block; animation: cv-rotate 1s linear infinite; }

.cv-copy {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; font-size: 12px; font-weight: 500; line-height: 1.7;
    border: 1px solid var(--editor-border); border-radius: 4px;
    background: var(--panel-bg); color: var(--muted);
    cursor: pointer; transition: color .15s, border-color .15s;
}
.cv-copy:hover { color: var(--link); border-color: var(--link); }
.section-title .cv-copy i { color: inherit; font-size: 12px; }
.cv-copy:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 说明块 ---------- */
.cv-note { font-size: 12px; line-height: 1.75; color: var(--muted); margin-top: 12px; }
.cv-note b { color: var(--text); }
.cv-note code { font-family: Consolas, Monaco, monospace; }
.cv-note i { color: var(--link); margin-right: 2px; }
.cv-note.warn { color: #d68910; }

/* ---------- 结果列表（键值行） ---------- */
.cv-kvlist { display: flex; flex-direction: column; gap: 7px; }
.cv-kvrow { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13px; }
.cv-kvrow > span { color: var(--muted); line-height: 1.75; }
.cv-kvrow > b, .cv-kvrow > code {
    font-weight: 600; color: var(--text); line-height: 1.75;
    word-break: break-all; font-family: Consolas, Monaco, monospace; font-size: 12.5px;
}
.cv-kvrow > code { cursor: pointer; }
.cv-kvrow > code:hover { color: var(--link); }

/* ---------- 大号数字显示（倒计时 / 时间差） ---------- */
.cv-bigrow { display: flex; flex-wrap: wrap; gap: 10px; }
.cv-bigcell {
    flex: 1 1 0; min-width: 74px; padding: 12px 6px; text-align: center;
    border: 1px solid var(--border); border-radius: 8px; background: var(--panel-head-bg);
}
.cv-bigcell > b {
    display: block; font-size: 26px; line-height: 1.25; font-weight: 700;
    font-family: Consolas, Monaco, monospace; color: var(--link);
}
.cv-bigcell > span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 卡片网格（姓名生成等） ---------- */
.cv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.cv-card {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 11px 8px; font-size: 15px; font-weight: 600; letter-spacing: .06em;
    border: 1px solid var(--border); border-radius: 7px;
    background: var(--panel-head-bg); color: var(--text);
    cursor: pointer; transition: all .15s; text-align: center;
}
.cv-card:hover { border-color: var(--link); color: var(--link); background: rgba(70,132,255,.07); }
.cv-card > small { font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; }

/* ---------- 移动端（Pure 的 md 断点 48em = 768px） ---------- */
@media (max-width: 767px) {
    .convert-grid > div { padding: 14px !important; }
    .convert-grid > div:first-child { border-right: none; border-bottom: 1px solid var(--border); }
    .section-title { line-height: 40px; font-size: 15px; }
    #outputCol { display: block; }
    .cv-result { flex: none; height: auto; min-height: 0; max-height: none; overflow: visible; }
    .editor-row .cv-textarea { height: 180px; }
    .cv-prow { grid-template-columns: 1fr; gap: 4px; }
    .cv-prow > label { line-height: 1.6; }
    .cv-kvrow { grid-template-columns: 1fr; gap: 2px; }
    .cv-empty { min-height: 140px; }
    .cv-bigcell { min-width: 62px; padding: 10px 4px; }
    .cv-bigcell > b { font-size: 21px; }
    .cv-cards { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
