@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@300;400;500&display=swap');

:root {
  color-scheme: dark;
  --bg: #161616;
  --surface: #1e1e1e;
  --surface-2: #191919;
  --border: #333333;
  --border-strong: #4a4a4a;
  --accent: #8ab4d8;
  --accent-dim: #44607a;
  --accent-bg: rgba(138, 180, 216, 0.08);
  --btn-bg: #33608c;
  --btn-bg-hover: #3d70a3;
  --text: #dcdcdc;
  --text-mid: #b0b0b0;
  --text-dim: #8a8a8a;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;

  /* syntax colors — muted, readable on dark */
  --syn-key:   #8ab4d8;   /* property key — soft blue */
  --syn-text:  #a3be8c;   /* text value — soft green */
  --syn-number:#d0a35f;   /* number — soft amber */
  --syn-date:  #c78a9b;   /* date — soft rose */
  --syn-bool:  #a99bd0;   /* boolean — soft violet */
  --syn-list:  #7fb8b8;   /* list — soft teal */
  --syn-link:  #8ab4d8;   /* link — soft blue */
  --syn-fence: #666666;
  --syn-hint:  #5a5a5a;

  /* type indicator colors (legend dots + select borders) */
  --type-text:    #8ab4d8;
  --type-number:  #d0a35f;
  --type-date:    #c78a9b;
  --type-boolean: #a99bd0;
  --type-list:    #7fb8b8;
  --type-link:    #a3be8c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 80px;
}

#theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface);
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  z-index: 10;
}

#theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

header {
  width: 100%;
  max-width: 780px;
  margin-bottom: 48px;
}

.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}

h1 {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

h1 span { color: var(--accent); }

.subtitle {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-mid);
  font-weight: 300;
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px;
  width: 100%;
  max-width: 780px;
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-head .card-title { margin-bottom: 0; }

.card-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.ghost-btn {
  font-family: var(--mono);
  font-size: 11px;
  background: none;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.ghost-btn:hover:not(:disabled) { border-color: var(--accent-dim); }
.ghost-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.row-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-nav span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 90px;
  text-align: center;
}

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: 3px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.6; }

.dropzone p {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}

.dropzone p strong { color: var(--accent); }

.or {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin: 16px 0;
  letter-spacing: 0.1em;
}

textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 14px;
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus { border-color: var(--accent-dim); }
textarea::placeholder { color: #555; }

/* Column table */
.col-table {
  width: 100%;
  border-collapse: collapse;
}

.col-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: left;
  padding: 0 0 10px 0;
  border-bottom: 1px solid var(--border);
}

.col-table th:not(:first-child) { padding-left: 12px; }
.col-table th.center { text-align: center; }

.col-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-2);
  vertical-align: middle;
}

.col-table td:not(:first-child) { padding-left: 12px; }
.col-table tr:last-child td { border-bottom: none; }

/* Highlight the entire row whose radio is checked */
.col-table tr:has(input[type="radio"]:checked) td {
  background: var(--accent-bg);
}

/* Fade rows that are excluded from the export */
.col-table tbody tr:has(.include-check:not(:checked)) .col-original,
.col-table tbody tr:has(.include-check:not(:checked)) .col-sample,
.col-table tbody tr:has(.include-check:not(:checked)) input[type="text"],
.col-table tbody tr:has(.include-check:not(:checked)) select {
  opacity: 0.4;
}

.col-original {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-sample {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

select, input[type="text"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
  appearance: none;
}

select:focus, input[type="text"]:focus { border-color: var(--accent-dim); }
select option { background: var(--surface); }

/* Type accent borders */
select.type-text    { border-left: 2px solid var(--type-text); }
select.type-number  { border-left: 2px solid var(--type-number); }
select.type-date    { border-left: 2px solid var(--type-date); }
select.type-boolean { border-left: 2px solid var(--type-boolean); }
select.type-list    { border-left: 2px solid var(--type-list); }
select.type-link    { border-left: 2px solid var(--type-link); }

/* Include checkbox */
.check-col { text-align: center; width: 28px; }

.check-col input[type="checkbox"] {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface-2);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  transition: all 0.15s;
}

.check-col input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.check-col input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-col input[type="checkbox"]:indeterminate {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Filename radio */
.radio-col { text-align: center; }

.radio-col input[type="radio"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  transition: all 0.2s;
}

.radio-col input[type="radio"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}

/* Option row */
.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mid);
  cursor: pointer;
}

.option-row input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* Preview */
.preview-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-mid);
  white-space: pre;
  overflow-x: auto;
}

.preview-box .prop-key      { color: var(--syn-key); }
.preview-box .type-text     { color: var(--syn-text); }
.preview-box .type-number   { color: var(--syn-number); }
.preview-box .type-date     { color: var(--syn-date); }
.preview-box .type-boolean  { color: var(--syn-bool); }
.preview-box .type-list     { color: var(--syn-list); }
.preview-box .type-link     { color: var(--syn-link); }
.preview-box .yaml-fence    { color: var(--syn-fence); }
.preview-box .filename-hint { color: var(--syn-hint); font-style: italic; }

/* Status */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 20px;
  width: 100%;
  max-width: 780px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.status-dot.ready { background: #7fae7f; }
.status-dot.error { background: #c97a7a; }

button#generate {
  width: 100%;
  max-width: 780px;
  padding: 16px;
  background: var(--btn-bg);
  color: #ffffff;
  border: none;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}

button#generate:hover:not(:disabled) {
  background: var(--btn-bg-hover);
}

button#generate:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.divider {
  width: 100%;
  max-width: 780px;
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0 20px;
}

.hint {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* Legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Footer */
.footer-credits {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 40px;
}

.footer-credits a { color: var(--accent); text-decoration: none; }
.footer-credits a:hover { text-decoration: underline; }

/* Archive banner */
.archive-banner {
  width: 100%;
  max-width: 780px;
  margin-bottom: 28px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-mid);
}

.archive-banner strong { color: var(--text); }

.archive-banner code {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}

.archive-banner a { color: var(--accent); text-decoration: none; }
.archive-banner a:hover { text-decoration: underline; }
