/* CSV to JSON converter - direction toggle, delimiter/header controls, two-pane
   input/output, error line, and a live preview table. Reuses base .btn / .seg /
   .field / .copy-btn; colors come from theme tokens only. */

/* Controls: direction on the left, delimiter + header on the right. */
.cj-controls {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
    justify-content: space-between; margin-bottom: 16px;
}
.cj-direction { display: flex; flex-direction: column; gap: 6px; }
.cj-options { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.cj-option { display: flex; flex-direction: column; gap: 6px; }
.cj-control-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.cj-delimiter, .cj-options .field { padding: 8px 10px; }

.cj-check {
    flex-direction: row; align-items: center; gap: 8px;
    font-size: 14px; color: var(--text); cursor: pointer; user-select: none;
    padding-bottom: 8px;
}
.cj-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.cj-disabled { opacity: .5; cursor: not-allowed; }
.cj-disabled input { cursor: not-allowed; }

/* Panes: side by side on wide screens, stacked on narrow. */
.cj-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .cj-panes { grid-template-columns: 1fr; } }

.cj-pane { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cj-pane-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; }
.cj-pane-label { font-size: 14px; color: var(--muted); font-weight: 600; }

.cj-area {
    width: 100%; box-sizing: border-box; min-height: 260px; resize: vertical;
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
    font-size: 14px; line-height: 1.5; tab-size: 2; padding: 12px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
    white-space: pre; overflow: auto;
}
.cj-area:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.cj-output { background: var(--bg); }

.cj-error { margin: 14px 0 0; font-variant-numeric: tabular-nums; }

/* Preview: a clean bordered table, horizontally scrollable when wide. */
.cj-preview { margin-top: 20px; }
.cj-preview:empty { margin-top: 0; }
.cj-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
    display: block; overflow-x: auto; white-space: nowrap;
    border: 1px solid var(--border); border-radius: 12px;
}
.cj-table th, .cj-table td {
    padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.cj-table th { background: var(--surface); color: var(--text); font-weight: 600; }
.cj-table td { color: var(--muted); }
.cj-table tr:last-child th, .cj-table tr:last-child td { border-bottom: none; }
.cj-table th:last-child, .cj-table td:last-child { border-right: none; }

.cj-preview-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
