/* CSV Converter page - amber/orange theme */
:root {
  --convert-primary: #d97706;
  --convert-primary-hover: #b45309;
  --convert-primary-muted: rgba(217, 119, 6, 0.10);
  --convert-accent: #f59e0b;
}

.convert-layout {
  max-width: 960px;
  margin: 0 auto;
}

.convert__badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--convert-primary);
  background: var(--convert-primary-muted);
  border-radius: 9999px;
}

/* ── Upload Section ── */
.convert__upload-section {
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.convert__upload {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
}

.convert__upload input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.convert__upload:hover,
.convert__upload--dragover {
  border-color: var(--convert-primary);
  background: var(--convert-primary-muted);
}

.convert__upload-icon {
  display: inline-flex;
  width: 48px; height: 48px;
  margin-bottom: 12px;
  color: var(--convert-primary);
}
.convert__upload-icon svg { width: 100%; height: 100%; }

.convert__upload-title {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.convert__upload-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.convert__file-info {
  display: none;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--convert-primary-muted);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  align-items: center;
  gap: 8px;
}
.convert__file-info.is-visible { display: flex; }
.convert__file-name { font-weight: 600; }
.convert__file-meta { color: var(--text-muted); margin-left: auto; font-size: 0.85rem; }

/* ── Preview Table ── */
.convert__preview-section {
  display: none;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.convert__preview-section.is-visible { display: block; }

.convert__preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.convert__preview-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.convert__preview-badge {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.convert__table-wrap {
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.convert__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.convert__table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.convert__table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.convert__table tr:hover td {
  background: var(--convert-primary-muted);
}

/* ── Export Section ── */
.convert__export-section {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.convert__export-section.is-visible { display: block; }

.convert__export-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px;
}

/* Tab Switcher */
.convert__tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.convert__tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.convert__tab:hover { color: var(--text); background: rgba(0,0,0,0.03); }
.convert__tab.is-active {
  background: var(--bg-card);
  color: var(--convert-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.convert__tab-icon { width: 18px; height: 18px; flex-shrink: 0; }
.convert__tab-icon svg { width: 100%; height: 100%; }

/* Table Name Input */
.convert__option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.convert__option-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.convert__option-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, 'Fira Code', monospace;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  min-width: 200px;
  transition: border-color 0.2s;
}
.convert__option-input:focus {
  outline: none;
  border-color: var(--convert-primary);
  box-shadow: 0 0 0 3px var(--convert-primary-muted);
}

/* Code Output */
.convert__output-wrap {
  position: relative;
  margin-bottom: 16px;
}
.convert__output {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 20px;
  font-family: ui-monospace, 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  tab-size: 2;
}

/* Action Buttons */
.convert__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.convert__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.convert__btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.convert__btn--primary {
  background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}
.convert__btn--primary:hover {
  background: linear-gradient(145deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 4px 12px rgba(217,119,6,0.25);
}

.convert__btn--secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.convert__btn--secondary:hover {
  border-color: var(--convert-primary);
  color: var(--convert-primary);
  background: var(--convert-primary-muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .convert-layout { padding: 0; }
  .convert__upload-section,
  .convert__preview-section,
  .convert__export-section { padding: 20px 16px; }
  .convert__tabs { flex-direction: column; }
  .convert__option-row { flex-direction: column; align-items: stretch; }
  .convert__option-input { min-width: 0; width: 100%; }
  .convert__actions { flex-direction: column; }
  .convert__btn { justify-content: center; }
}
