/* ================================================================
   菜刀客在线工具页 · csv-to-json.html 私有样式
   需在 /css/common.css 之后加载。
   ================================================================ */

/* ---- 覆盖公共值：本页容器更宽 ---- */
.container {
    max-width: 1400px;
}

.footer {
    max-width: 1400px;
}

/* ---- 覆盖公共按钮：本页 btn-secondary 为深色 ---- */
.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* ---- 覆盖公共布局：双栏并排 ---- */
.main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ---- 面板：本页为等高列布局 ---- */
.panel {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.panel-header {
    border-bottom: none;
    order: 0;
    flex-shrink: 0;
}

.tab-bar {
    order: 1;
    flex-shrink: 0;
}

.tab {
    padding: 10px 20px;
    float: left;
}

.tab-content {
    display: none;
    order: 2;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.status-bar {
    flex-direction: column;
    align-items: stretch;
    order: 4;
    flex-shrink: 0;
}

/* ---- 选项栏 ---- */
.options-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 12px 15px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    order: 1;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-group label {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

.option-select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-label input[type="checkbox"] {
    accent-color: #667eea;
}

/* ---- 输入 / 输出区 ---- */
.editor-wrap {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    order: 2;
}

.line-numbers {
    flex-shrink: 0;
    min-width: 44px;
    padding: 15px 8px 15px 10px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    text-align: right;
    color: #9ca3af;
    white-space: pre;
    user-select: none;
    overflow: hidden;
}

.editor-wrap textarea {
    flex: 1;
    width: auto;
    min-width: 0;
    height: auto;
}

textarea {
    width: 100%;
    height: 512px;
    padding: 15px;
    border: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

/* ---- 输出编辑器（带行号） ---- */
.output-wrap {
    display: flex;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

#output {
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    box-sizing: border-box;
    overflow: auto;
}

#minifiedOutput {
    flex: 1;
    min-height: 0;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    box-sizing: border-box;
    overflow: auto;
}

/* ---- JSON 语法高亮 ---- */
.json-key {
    color: #881391;
}

.json-string {
    color: #0b7500;
}

.json-number {
    color: #1750eb;
}

.json-boolean {
    color: #ff6d01;
}

.json-null {
    color: #999;
}

/* ---- 预览表格 ---- */
.preview-table-wrap {
    flex: 1;
    min-height: 0;
    padding: 15px;
    box-sizing: border-box;
    overflow: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table th,
.preview-table td {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    text-align: left;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
}

.preview-table tr:hover td {
    background: #fafbff;
}

.null-value {
    color: #9ca3af;
    font-style: italic;
}

.empty-value {
    color: #d1d5db;
}

.preview-more {
    padding: 12px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* ---- 文件上传 / 统计 ---- */
.file-input {
    display: none;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-label {
    color: #9ca3af;
}

.stat-value {
    font-weight: 600;
    color: #374151;
}

/* ---- SEO 知识文章美化 ---- */
.seo-article {
    line-height: 1.85;
    color: #3f4857;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.seo-article h2 {
    font-size: 18px;
    color: #1f2937;
    margin: 22px 0 10px;
    padding-left: 10px;
    border-left: 4px solid #667eea;
    line-height: 1.4;
}

.seo-article h2:first-child {
    margin-top: 0;
}

.seo-article p {
    font-size: 14px;
    line-height: 1.8;
    color: #4b5563;
}

.seo-article ul {
    margin: 8px 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.9;
    color: #4b5563;
}

.seo-article li {
    margin-bottom: 6px;
}

.seo-article strong {
    color: #374151;
    font-weight: 600;
}

.seo-article code {
    background: #eef2ff;
    color: #4338ca;
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.92em;
    font-family: "SFMono-Regular", Consolas, monospace;
}

/* ---- 小屏：双栏改上下纵向排列 ---- */
@media (max-width: 600px) {
    .main {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .panel {
        height: auto;
    }

    .editor-wrap {
        flex: none;
    }

    .editor-wrap textarea {
        height: 220px;
    }

    textarea {
        height: auto;
        min-height: 180px;
        resize: vertical;
    }

    #output,
    #minifiedOutput,
    .preview-table-wrap {
        min-height: 180px;
    }

    .options-bar {
        flex-direction: column;
        gap: 10px;
    }
}