/* CSV Column Editor page - teal theme */
:root {
  --coleditor-primary: #0891b2;
  --coleditor-primary-hover: #0e7490;
  --coleditor-primary-muted: rgba(8, 145, 178, 0.10);
}

.coleditor-layout { max-width: 960px; margin: 0 auto; }

.coleditor__badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--coleditor-primary);
  background: var(--coleditor-primary-muted);
  border-radius: 9999px;
}

/* ── Upload ── */
.coleditor__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);
}
.coleditor__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);
}
.coleditor__upload:hover,
.coleditor__upload--dragover {
  border-color: var(--coleditor-primary);
  background: var(--coleditor-primary-muted);
}
.coleditor__upload input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.coleditor__upload-icon { display: inline-flex; width: 44px; height: 44px; margin-bottom: 10px; color: var(--coleditor-primary); }
.coleditor__upload-icon svg { width: 100%; height: 100%; }
.coleditor__upload-title { display: block; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.coleditor__upload-hint { font-size: 0.9rem; color: var(--text-muted); }

.coleditor__file-info {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--coleditor-primary-muted);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  align-items: center;
  gap: 8px;
}
.coleditor__file-info.is-visible { display: flex; }
.coleditor__file-name { font-weight: 600; }
.coleditor__file-meta { color: var(--text-muted); margin-left: auto; font-size: 0.85rem; }

/* ── Editor section ── */
.coleditor__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);
}
.coleditor__section.is-visible { display: block; }

.coleditor__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.coleditor__section-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.coleditor__hint { font-size: 0.82rem; color: var(--text-muted); }

/* ── Column list ── */
.coleditor__col-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.coleditor__col-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}
.coleditor__col-item.is-hidden {
  opacity: 0.45;
  background: var(--bg);
}
.coleditor__col-item.is-dragging { opacity: 0.5; }
.coleditor__col-item.drag-over { border-color: var(--coleditor-primary); background: var(--coleditor-primary-muted); }

.coleditor__drag-handle {
  cursor: grab;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 2px;
}
.coleditor__drag-handle:active { cursor: grabbing; }
.coleditor__drag-handle svg { width: 18px; height: 18px; }

.coleditor__col-name {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  padding: 3px 6px;
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.coleditor__col-name:hover,
.coleditor__col-name:focus {
  border-color: var(--coleditor-primary);
  background: var(--bg-card);
  outline: none;
}

.coleditor__btn-toggle,
.coleditor__btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.coleditor__btn-toggle svg { width: 17px; height: 17px; }
.coleditor__btn-toggle:hover { color: var(--coleditor-primary); background: var(--coleditor-primary-muted); }
.coleditor__btn-delete { font-size: 1.1rem; line-height: 1; width: 24px; height: 24px; justify-content: center; }
.coleditor__btn-delete:hover { color: #dc2626; background: rgba(220,38,38,0.08); }

/* ── Actions ── */
.coleditor__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}
.coleditor__btn-reset {
  padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.coleditor__btn-reset:hover { border-color: var(--coleditor-primary); color: var(--coleditor-primary); }

.coleditor__btn-download {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  background: var(--coleditor-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.coleditor__btn-download:hover { background: var(--coleditor-primary-hover); }
.coleditor__btn-download svg { width: 17px; height: 17px; }

/* ── Preview ── */
.coleditor__preview-section {
  display: none;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.coleditor__preview-section.is-visible { display: block; }
.coleditor__preview-title { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.coleditor__preview-wrap {
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.coleditor__table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.coleditor__table th, .coleditor__table td { padding: 6px 10px; border: 1px solid var(--border); text-align: left; white-space: nowrap; }
.coleditor__table th { background: var(--bg); font-weight: 600; color: var(--text); position: sticky; top: 0; z-index: 1; }
.coleditor__table td:first-child, .coleditor__table th:first-child { color: var(--text-muted); width: 40px; text-align: center; }
