/* Page CSS for CSV to JSON.
   Loaded after the shared css/style.css. Intentionally does NOT redeclare
   body { font-family } — the shared stylesheet owns the system font stack. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f5f5f5;
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

body.dark-mode .container { background: #252525; border-color: #404040; }

header {
    background: #ffffff;
    color: #333;
    padding: 24px 80px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
}

body.dark-mode header { background: #2d2d2d; border-bottom-color: #404040; color: #e0e0e0; }

header h1 { font-size: 20px; margin-bottom: 8px; color: #333; font-weight: 600; letter-spacing: -0.3px; }
body.dark-mode header h1 { color: #e0e0e0; }
header p { font-size: 11px; color: #64748b; margin: 0; font-weight: 400; }
header p.header-description { display: block; }
body.dark-mode header p { color: #94a3b8; }

/* Buttons */
button {
    padding: 0px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    background: #2563eb;
    color: white;
    height: 34px;
}

button:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
button:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

button.secondary { background: #6c757d; }
button.secondary:hover { background: #5a6268; }
button.success { background: #218838; color: #fff; }
button.success:hover { background: #1e7e34; }
button.danger { background: #dc3545; }
button.danger:hover { background: #c82333; }
button.primary { background: #2563eb; }
button.primary:hover { background: #1d4ed8; }
button.small { padding: 0px 14px; font-size: 12px; font-weight: 500; height: 30px; border-radius: 6px; }

button:disabled, button:disabled:hover { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; }

body.dark-mode button { color: white; }

/* Main tool area */
.csv-main-content { padding: 20px; }

.csv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.csv-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 34px;
}

.csv-panel-header h2 { margin: 0; font-size: 15px; font-weight: 600; color: #333; }
body.dark-mode .csv-panel-header h2 { color: #e0e0e0; }
.csv-panel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.csv-textarea {
    display: block;
    width: 100%;
    height: 280px;
    padding: 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    resize: vertical;
    background: #fff;
    color: #333;
}

.csv-textarea.csv-output { height: 400px; }
.csv-textarea::placeholder { color: #6b7280; opacity: 1; }
.csv-textarea:focus { outline: none; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0,102,204,0.12); }
body.dark-mode .csv-textarea { background: #1a1a1a; border-color: #404040; color: #e0e0e0; }
body.dark-mode .csv-textarea::placeholder { color: #9ca3af; }

/* Dropzone: an enhancement wrapped around a real, visible file input */
.csv-dropzone {
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 2px dashed #6b7280;
    border-radius: 10px;
    background: #f8fafc;
    color: #374151;
    font-size: 13px;
    line-height: 1.5;
}

.csv-dropzone.csv-dropzone-active { border-color: #0066cc; background: #e8f1fb; }
body.dark-mode .csv-dropzone { border-color: #8b95a5; background: #2d2d2d; color: #e0e0e0; }
body.dark-mode .csv-dropzone.csv-dropzone-active { border-color: #6bb6ff; background: #243247; }
.csv-dropzone label { display: block; font-weight: 600; margin-bottom: 6px; }
.csv-dropzone input[type="file"] { display: block; width: 100%; max-width: 100%; font-size: 13px; color: inherit; }
.csv-dropzone .csv-drop-hint { margin-top: 6px; font-size: 12px; color: #4b5563; }
body.dark-mode .csv-dropzone .csv-drop-hint { color: #b8bfcc; }

/* Reserved single lines (no layout shift when text changes) */
.csv-line { min-height: 22px; margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: #475569; overflow-wrap: anywhere; }
body.dark-mode .csv-line { color: #b8bfcc; }
.csv-stats { min-height: 28px; margin: 4px 0 8px; font-size: 14px; font-weight: 600; color: #1f2937; }
body.dark-mode .csv-stats { color: #e5e9f0; }

/* Options */
.csv-options { margin-top: 16px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px 14px; background: #f8fafc; min-width: 0; }
body.dark-mode .csv-options { border-color: #404040; background: #2d2d2d; }
.csv-options legend { font-size: 14px; font-weight: 600; padding: 0 6px; color: #333; }
body.dark-mode .csv-options legend { color: #e0e0e0; }
.csv-opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.csv-opt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.csv-opt > label { font-size: 12.5px; font-weight: 600; color: #374151; }
body.dark-mode .csv-opt > label { color: #d5dae3; }
.csv-opt select {
    height: 36px;
    padding: 0 8px;
    border: 1.5px solid #9ca3af;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 13px;
    width: 100%;
}
body.dark-mode .csv-opt select { background: #1a1a1a; border-color: #6b7280; color: #e0e0e0; }
.csv-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: #333; cursor: pointer; min-height: 36px; }
body.dark-mode .csv-check { color: #e0e0e0; }
.csv-check input { width: 16px; height: 16px; cursor: pointer; accent-color: #0066cc; flex-shrink: 0; }
.csv-opt select:disabled, .csv-check input:disabled { cursor: not-allowed; }
.csv-check.csv-disabled { opacity: 0.6; cursor: not-allowed; }
.csv-opt.csv-disabled { opacity: 0.6; }

.csv-advanced { margin-top: 12px; border-top: 1px solid #e5e7eb; padding-top: 6px; }
body.dark-mode .csv-advanced { border-top-color: #404040; }
.csv-advanced summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: #333; padding: 8px 0; min-height: 40px; display: list-item; }
body.dark-mode .csv-advanced summary { color: #e0e0e0; }
.csv-advanced .csv-opt-grid { margin-top: 8px; }

.csv-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.csv-actions button { height: 38px; padding: 0 22px; font-weight: 600; }

/* Warning / notice list: fixed height + scroll so it never pushes the output */
.csv-messages {
    height: 120px;
    overflow-y: auto;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}
body.dark-mode .csv-messages { background: #1a1a1a; border-color: #404040; }
.csv-messages ul { list-style: none; }
.csv-msg { font-size: 12.5px; line-height: 1.5; padding: 4px 8px; border-radius: 6px; margin-bottom: 4px; overflow-wrap: anywhere; }
.csv-msg-none { color: #475569; padding-left: 0; }
.csv-msg-warning { background: #fff3cd; color: #664d03; }
.csv-msg-notice { background: #e8f1fb; color: #1e3a5f; }
body.dark-mode .csv-msg-none { color: #b8bfcc; }
body.dark-mode .csv-msg-warning { background: #3a2f0b; color: #ffe08a; }
body.dark-mode .csv-msg-notice { background: #1f2a3d; color: #cfe3ff; }

.csv-note { margin-top: 14px; font-size: 12.5px; line-height: 1.6; color: #475569; }
body.dark-mode .csv-note { color: #b8bfcc; }

code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 0.92em; background: #eef1f4; color: #1f2937; padding: 1px 5px; border-radius: 4px; }
body.dark-mode code { background: #333a45; color: #e5e9f0; }

/* Long-form content */
.csv-content { padding: 28px 30px 8px; border-top: 1px solid #e5e7eb; }
body.dark-mode .csv-content { border-top-color: #404040; }
.csv-content h2 { font-size: 22px; font-weight: 600; margin: 30px 0 12px; color: #1f2937; }
.csv-content h2:first-child { margin-top: 0; }
.csv-content h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; color: #0052a3; }
body.dark-mode .csv-content h2 { color: #e5e9f0; }
body.dark-mode .csv-content h3 { color: #6bb6ff; }
.csv-content p { font-size: 14.5px; line-height: 1.75; color: #3b4351; margin-bottom: 12px; max-width: 90ch; }
body.dark-mode .csv-content p { color: #ccc; }
.csv-content ul { margin: 0 0 14px 22px; font-size: 14.5px; line-height: 1.8; color: #3b4351; max-width: 90ch; }
body.dark-mode .csv-content ul { color: #ccc; }
.csv-content a { color: #1d4ed8; }
body.dark-mode .csv-content a { color: #6bb6ff; }
/* style.css strips underlines from every link with !important; body-text links need one back */
.csv-content p a, .csv-content li a { text-decoration: underline !important; }
.csv-answer { font-size: 15px; font-weight: 500; }

pre.csv-code {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    line-height: 1.55;
    color: #1f2937;
    max-width: 100%;
}
body.dark-mode pre.csv-code { background: #1a1a1a; border-color: #404040; color: #e0e0e0; }
.csv-code-label { font-size: 12px; font-weight: 600; color: #475569; margin: 0 0 4px !important; }
body.dark-mode .csv-code-label { color: #b8bfcc; }

.faq-section { padding: 28px 30px 40px; }
.faq-section h2 { font-size: 22px; font-weight: 600; color: #1f2937; margin-bottom: 16px; }
body.dark-mode .faq-section h2 { color: #e5e9f0; }
.faq-item { border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 10px; padding: 14px 18px; background: #fff; }
body.dark-mode .faq-item { border-color: #404040; background: #2d2d2d; }
.faq-question { cursor: pointer; font-weight: 600; font-size: 14px; color: #333; }
body.dark-mode .faq-question { color: #e0e0e0; }
.faq-answer p { font-size: 13.5px; line-height: 1.7; color: #4b5563; margin-top: 10px; }
body.dark-mode .faq-answer p { color: #b8bfcc; }

/* "Built by" note */
.builder-note { text-align: center; padding: 16px 24px; background: #f0f4ff; border-top: 1px solid #dde4f0; font-size: 0.95rem; color: #444; }
.builder-note p { line-height: 1.6; }
body.dark-mode .builder-note { background: #1e2433; border-top-color: #2d3748; color: #b8bfcc; }
body.dark-mode .builder-note a { color: #6bb6ff; }

/* Footer */
footer { margin-top: 30px; border-top: 1px solid #e5e7eb; color: #666; font-size: 12px; }
.footer-content { max-width: 1400px; margin: 0 auto; padding: 30px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; text-align: left; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.footer-brand-name { font-weight: 700; color: #333; font-size: 15px; }
body.dark-mode .footer-brand-name { color: #e0e0e0; }
.footer-section p { margin: 0 0 10px 0; line-height: 1.6; color: #666; }
.footer-section ul { list-style: none; padding: 0; margin: 0; }
.footer-section ul li { padding: 4px 0; color: #666; line-height: 1.5; }
.footer-section ul li a { color: #0066cc; text-decoration: none; }
.footer-section ul li a:hover { text-decoration: underline; }
.footer-bottom { text-align: center; padding: 20px; border-top: 1px solid #e5e7eb; background: #f9fafb; }
.footer-bottom p { margin: 0 0 15px 0; }
.footer-links { display: flex !important; align-items: center; justify-content: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.footer-links a { color: #6b7c94 !important; text-decoration: none; white-space: nowrap; }
.footer-links a:hover { color: #a5b4fc !important; text-decoration: underline; }
.footer-separator { color: #999; margin: 0 4px; }

body.dark-mode footer { border-top-color: #404040; background: #1a1a1a; }
body.dark-mode .footer-content { background: #1a1a1a; }
body.dark-mode .footer-section p,
body.dark-mode .footer-section ul li { color: #b0b0b0; }
body.dark-mode .footer-section ul li a { color: #6bb6ff; }
body.dark-mode .footer-bottom { background: #252525; border-top-color: #404040; }
body.dark-mode .footer-links a { color: #6a7990 !important; }
body.dark-mode .footer-links a:hover { color: #a5b4fc !important; }
body.dark-mode .footer-separator { color: #666; }

/* Responsive: stacked layout on mobile, same 768px breakpoint as the sibling pages */
@media (max-width: 768px) {
    body { padding: 5px; }
    .container { border-radius: 0; margin: 0; max-width: 100%; }
    header { padding: 15px 15px; text-align: left; }
    header h1 { font-size: 16px; line-height: 1.3; margin-bottom: 6px; text-align: center; }
    header p { font-size: 10px; line-height: 1.4; text-align: center; }

    .csv-main-content { padding: 15px 10px; }
    .csv-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .csv-textarea { height: 220px; }
    .csv-textarea.csv-output { height: 280px; }
    .csv-panel-actions { width: 100%; }
    .csv-panel-actions button { flex: 1 1 auto; }
    .csv-opt-grid { grid-template-columns: minmax(0, 1fr); }

    /* Minimum 48x48px touch targets */
    button, button.small { min-height: 48px; min-width: 48px; }
    .csv-opt select { height: 48px; font-size: 16px; }
    .csv-check { min-height: 48px; }
    .csv-check input { width: 22px; height: 22px; }
    .csv-dropzone input[type="file"] { min-height: 48px; font-size: 14px; }
    .csv-advanced summary, .faq-question { min-height: 48px; padding: 13px 0; }
    .csv-actions button { flex: 1 1 auto; }

    .csv-content { padding: 20px 12px 4px; }
    .csv-content h2 { font-size: 20px; }
    .faq-section { padding: 20px 12px 28px; }
    .builder-note { padding: 16px 15px; }

    .footer-content { grid-template-columns: 1fr; gap: 20px; padding: 20px 15px; }
    .footer-section { text-align: center; }
    .footer-section ul { text-align: left; display: inline-block; }
}
