/* ============================================================
   DummyHub — unified tool design (light "circuit" theme)
   One stylesheet for all four generators. The widgets keep their
   original class taxonomy (dh- / dhi- / dhf- / dhd- prefixes);
   every rule targets all prefixes via :is().
   Output/code areas stay dark, like editor panels.
   ============================================================ */

:is(.dh-wrap, .dhi-wrap, .dhf-wrap, .dhd-wrap) {
  max-width: 1240px;
  margin: 0 auto;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 14px;
  line-height: 1.6;
  color: #5a5e78;
  -webkit-font-smoothing: antialiased;
}

:is(.dh-wrap, .dhi-wrap, .dhf-wrap, .dhd-wrap) *,
:is(.dh-wrap, .dhi-wrap, .dhf-wrap, .dhd-wrap) *::before,
:is(.dh-wrap, .dhi-wrap, .dhf-wrap, .dhd-wrap) *::after { box-sizing: border-box; }

/* ---------- Grids ---------- */
:is(.dh-grid, .dhi-grid, .dhf-grid, .dhd-grid) { display: grid; gap: 20px; }
:is(.dh-grid-2, .dhi-grid-2, .dhf-grid-2) { grid-template-columns: repeat(2, 1fr); }
:is(.dh-grid-3, .dhi-grid-3, .dhf-grid-3, .dhd-grid-3) { grid-template-columns: repeat(3, 1fr); }
.dh-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Panels ---------- */
:is(.dh-controls, .dhi-controls, .dhf-controls, .dhd-controls) {
  padding: 30px;
  border: 1px solid rgba(20, 20, 60, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 2px rgba(20, 20, 60, 0.05), 0 10px 34px rgba(20, 20, 60, 0.07);
  position: relative;
  overflow: visible;
}

:is(.dh-controls, .dhi-controls, .dhf-controls, .dhd-controls)::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, transparent 4%, rgba(124, 92, 246, 0.5) 50%, transparent 96%);
  pointer-events: none;
}

/* ---------- Fields ---------- */
:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) { display: flex; flex-direction: column; gap: 7px; }

:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) label {
  font-size: 11.5px;
  font-weight: 500;
  color: #9296ad;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

:is(.dh-select-wrap, .dhi-select-wrap, .dhf-select-wrap, .dhd-select-wrap) { position: relative; }

:is(.dh-select-wrap, .dhi-select-wrap, .dhf-select-wrap, .dhd-select-wrap) select,
:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) input[type="number"],
:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) input[type="text"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 14px;
  border: 1px solid rgba(20, 20, 60, 0.12);
  border-radius: 11px;
  background: #fff;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 14px;
  color: #2b2e48;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

:is(.dh-select-wrap, .dhi-select-wrap, .dhf-select-wrap, .dhd-select-wrap) select { padding-right: 38px; cursor: pointer; }

:is(.dh-select-wrap, .dhi-select-wrap, .dhf-select-wrap, .dhd-select-wrap) select:hover,
:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) input:hover { border-color: rgba(20, 20, 60, 0.22); }

:is(.dh-select-wrap, .dhi-select-wrap, .dhf-select-wrap, .dhd-select-wrap) select:focus,
:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) input:focus {
  outline: none;
  border-color: rgba(124, 92, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.15);
}

:is(.dh-field, .dhi-field, .dhf-field, .dhd-field) input::placeholder { color: #b9bccc; }

:is(.dh-select-chevron, .dhi-select-chevron, .dhf-select-chevron, .dhd-select-chevron) {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #9296ad;
  pointer-events: none;
}

/* color input (image tool) */
.dhi-color-input {
  width: 100%;
  height: 42px;
  padding: 4px;
  border: 1px solid rgba(20, 20, 60, 0.12);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

/* ---------- Toggles ---------- */
:is(.dh-toggles-row, .dhi-toggles-row, .dhf-toggles-row, .dhd-toggles-row) {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.dh-toggles-inline { display: flex; flex-wrap: wrap; gap: 20px; }

:is(.dh-toggle, .dhi-toggle, .dhf-toggle, .dhd-toggle) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

:is(.dh-toggle, .dhi-toggle, .dhf-toggle, .dhd-toggle) input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

:is(.dh-toggle-switch, .dhi-toggle-switch, .dhf-toggle-switch, .dhd-toggle-switch) {
  position: relative;
  width: 40px;
  height: 22px;
  background: #d7d9e6;
  border-radius: 11px;
  transition: background 0.25s ease, box-shadow 0.25s ease;
  flex-shrink: 0;
}

:is(.dh-toggle-switch, .dhi-toggle-switch, .dhf-toggle-switch, .dhd-toggle-switch)::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(20, 20, 60, 0.25);
}

:is(.dh-toggle, .dhi-toggle, .dhf-toggle, .dhd-toggle) input:checked + :is(.dh-toggle-switch, .dhi-toggle-switch, .dhf-toggle-switch, .dhd-toggle-switch) {
  background: linear-gradient(120deg, #7c5cf6, #4f7dff);
  box-shadow: 0 2px 10px rgba(124, 92, 246, 0.35);
}

:is(.dh-toggle, .dhi-toggle, .dhf-toggle, .dhd-toggle) input:checked + :is(.dh-toggle-switch, .dhi-toggle-switch, .dhf-toggle-switch, .dhd-toggle-switch)::after { transform: translateX(18px); }

:is(.dh-toggle, .dhi-toggle, .dhf-toggle, .dhd-toggle) input:focus-visible + :is(.dh-toggle-switch, .dhi-toggle-switch, .dhf-toggle-switch, .dhd-toggle-switch) { box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.22); }

:is(.dh-toggle-label, .dhi-toggle-label, .dhf-toggle-label, .dhd-toggle-label) { font-size: 13px; color: #5a5e78; }

/* ---------- Buttons ---------- */
:is(.dh-btn, .dhi-btn, .dhf-btn, .dhd-btn) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

:is(.dh-btn, .dhi-btn, .dhf-btn, .dhd-btn):active { transform: scale(0.97); }

:is(.dh-btn-generate, .dhi-btn-generate, .dhf-btn-generate, .dhd-btn-generate) {
  background: linear-gradient(120deg, #7c5cf6 0%, #4f7dff 100%);
  color: #fff;
  padding: 13px 30px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(124, 92, 246, 0.30);
}

:is(.dh-btn-generate, .dhi-btn-generate, .dhf-btn-generate, .dhd-btn-generate):hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 30px rgba(124, 92, 246, 0.40);
  transform: translateY(-1px);
}

:is(.dh-btn-secondary, .dhi-btn-secondary, .dhd-btn-secondary) {
  background: #fff;
  color: #2b2e48;
  border: 1px solid rgba(20, 20, 60, 0.12);
  padding: 9px 16px;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(20, 20, 60, 0.05);
}
:is(.dh-btn-secondary, .dhi-btn-secondary, .dhd-btn-secondary):hover { background: #f2f3fa; }

:is(.dh-btn-ghost, .dhi-btn-ghost, .dhf-btn-ghost, .dhd-btn-ghost) {
  background: transparent;
  color: #7b7f99;
  padding: 10px 16px;
  font-size: 13px;
}
:is(.dh-btn-ghost, .dhi-btn-ghost, .dhf-btn-ghost, .dhd-btn-ghost):hover { background: rgba(20, 20, 60, 0.05); color: #2b2e48; }

:is(.dh-btn-tool, .dhi-btn-tool, .dhf-btn-tool, .dhd-btn-tool) {
  background: #fff;
  color: #5a5e78;
  padding: 8px 15px;
  font-size: 13px;
  border: 1px solid rgba(20, 20, 60, 0.12);
  border-radius: 999px;
}
:is(.dh-btn-tool, .dhi-btn-tool, .dhf-btn-tool, .dhd-btn-tool):hover {
  background: rgba(124, 92, 246, 0.08);
  color: #5f3edd;
  border-color: rgba(124, 92, 246, 0.4);
}

:is(.dh-btn-success, .dhi-btn-success, .dhd-btn-success) {
  background: #059669 !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 12px rgba(5, 150, 105, 0.35) !important;
}

:is(.dh-btn-text, .dhi-btn-text, .dhf-btn-text, .dhd-btn-text) { display: inline; }

/* ---------- Actions row + advanced toggle ---------- */
:is(.dh-actions-row, .dhi-actions-row, .dhf-actions-row, .dhd-actions-row) {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid rgba(20, 20, 60, 0.07);
}

:is(.dh-actions-row, .dhi-actions-row, .dhf-actions-row, .dhd-actions-row) :is(.dh-btn-ghost, .dhi-btn-ghost, .dhf-btn-ghost, .dhd-btn-ghost) { margin-left: auto; }

:is(.dh-chevron-icon, .dhi-chevron-icon, .dhf-chevron-icon, .dhd-chevron-icon) { transition: transform 0.3s ease; }
:is(.dh-advanced-open, .dhi-advanced-open, .dhf-advanced-open, .dhd-advanced-open) :is(.dh-chevron-icon, .dhi-chevron-icon, .dhf-chevron-icon, .dhd-chevron-icon) { transform: rotate(180deg); }

/* ---------- Advanced panel ---------- */
:is(.dh-advanced, .dhi-advanced, .dhf-advanced, .dhd-advanced) {
  margin-top: 12px;
  padding: 26px 30px;
  border: 1px solid rgba(124, 92, 246, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(124, 92, 246, 0.045) 0%, rgba(79, 125, 255, 0.03) 100%), #fff;
  box-shadow: 0 1px 2px rgba(20, 20, 60, 0.04);
  animation: dht-slide-down 0.3s ease;
}

@keyframes dht-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

:is(.dh-advanced-section, .dhi-advanced-section, .dhf-advanced-section, .dhd-advanced-section) {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(20, 20, 60, 0.07);
}
:is(.dh-advanced-section, .dhi-advanced-section, .dhf-advanced-section, .dhd-advanced-section):last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: none; }

:is(.dh-section-title, .dhi-section-title, .dhf-section-title, .dhd-section-title) {
  font-size: 11.5px;
  font-weight: 500;
  color: #9296ad;
  margin: 0 0 16px 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Output panels ---------- */
:is(.dh-output-panel, .dhi-output-panel, .dhf-output-panel, .dhd-output-panel) {
  margin-top: 24px;
  border: 1px solid rgba(20, 20, 60, 0.08);
  border-radius: 18px;
  overflow: hidden;
  animation: dht-slide-down 0.3s ease;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 20, 60, 0.05), 0 10px 34px rgba(20, 20, 60, 0.07);
}

:is(.dh-toolbar, .dhi-toolbar, .dhf-toolbar, .dhd-toolbar) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: #fafbfe;
  border-bottom: 1px solid rgba(20, 20, 60, 0.07);
  gap: 12px;
  flex-wrap: wrap;
}

:is(.dh-stats, .dhi-stats, .dhf-stats, .dhd-stats) {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #7b7f99;
  flex-wrap: wrap;
}
:is(.dh-stat-value, .dhi-stat-value, .dhf-stat-value, .dhd-stat-value) { font-weight: 600; color: #14142b; }
:is(.dh-stat-dot, .dhi-stat-dot, .dhf-stat-dot, .dhd-stat-dot) { width: 3px; height: 3px; border-radius: 50%; background: #c9ccdb; }
:is(.dh-toolbar-actions, .dhi-toolbar-actions, .dhf-toolbar-actions, .dhd-toolbar-actions) { display: flex; gap: 8px; flex-wrap: wrap; }

/* Text output: generated content typography */
.dh-output { padding: 28px 32px; min-height: 140px; }
.dh-output p {
  margin: 0 0 20px;
  line-height: 1.8;
  color: #444965;
  font-family: var(--font-sans, 'DM Sans', sans-serif);
  font-size: 15px;
}
.dh-output p:last-child { margin-bottom: 0; }
.dh-output :is(h1, h2, h3, h4) {
  margin: 26px 0 10px;
  font-family: var(--font-sans, 'DM Sans', sans-serif);
  font-size: 19px;
  font-weight: 600;
  color: #14142b;
}
.dh-output :is(h1, h2, h3, h4):first-child { margin-top: 0; }
.dh-output :is(ul, ol) { margin: 0; padding-left: 24px; font-family: var(--font-sans, 'DM Sans', sans-serif); }
.dh-output li { margin-bottom: 10px; line-height: 1.7; color: #444965; font-size: 15px; }

/* Raw output (text tool) — dark editor panel */
.dh-raw-panel { border-top: 1px solid rgba(20, 20, 60, 0.07); }
.dh-raw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: #fafbfe;
}
.dh-raw-label { font-size: 12px; color: #9296ad; letter-spacing: 0.05em; text-transform: uppercase; }
.dh-raw-output {
  margin: 0;
  padding: 22px 26px;
  background: #14142b;
  color: #c8ccdf;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 420px;
  overflow-y: auto;
}

/* Image preview: light checkerboard */
.dhi-preview-area {
  padding: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background-image:
    linear-gradient(45deg, #eef0f6 25%, transparent 25%),
    linear-gradient(-45deg, #eef0f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef0f6 75%),
    linear-gradient(-45deg, transparent 75%, #eef0f6 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.dhi-preview-area canvas {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 10px 34px rgba(20, 20, 60, 0.18);
}

/* File preview + progress */
.dhf-preview { padding: 24px 28px; }
.dhf-preview-content {
  margin: 0;
  padding: 20px 24px;
  background: #14142b;
  border-radius: 12px;
  color: #c8ccdf;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 380px;
  overflow-y: auto;
}

:is(.dhf-progress-wrap, .dhd-progress-wrap) {
  margin-top: 20px;
  padding: 16px 24px;
  border: 1px solid rgba(20, 20, 60, 0.08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 20, 60, 0.05);
  animation: dht-slide-down 0.3s ease;
}

:is(.dhf-progress-bar, .dhd-progress-bar) {
  width: 100%;
  height: 6px;
  background: #e7e9f2;
  border-radius: 3px;
  overflow: hidden;
}

:is(.dhf-progress-fill, .dhd-progress-fill) {
  height: 100%;
  background: linear-gradient(90deg, #7c5cf6, #4f7dff);
  border-radius: 3px;
  transition: width 0.15s ease;
  width: 0%;
}

:is(.dhf-progress-text, .dhd-progress-text) {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #7b7f99;
  text-align: center;
}

/* ============================================================
   Data generator specifics
   ============================================================ */

.dhd-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.dhd-panel-title {
  font-family: var(--font-sans, 'DM Sans', sans-serif);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #14142b;
}
.dhd-panel-subtitle { font-size: 13px; color: #9296ad; margin: 0; }
.dhd-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Schema field list */
.dhd-fields-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.dhd-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: #9296ad;
  font-size: 14px;
  border: 1px dashed rgba(20, 20, 60, 0.15);
  border-radius: 12px;
  background: #fafbfe;
}
.dhd-empty-state strong { color: #5a5e78; font-weight: 500; }

.dhd-field-row {
  display: grid;
  grid-template-columns: 20px minmax(160px, 1fr) minmax(180px, 240px) minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid rgba(20, 20, 60, 0.08);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}
.dhd-field-row:hover { border-color: rgba(20, 20, 60, 0.16); box-shadow: 0 2px 8px rgba(20, 20, 60, 0.05); }
.dhd-field-row.dhd-dragging { opacity: 0.4; }
.dhd-field-row.dhd-drag-over { border-color: #7c5cf6; border-style: dashed; }

.dhd-field-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c9ccdb;
  cursor: grab;
  height: 100%;
  width: 20px;
}
.dhd-field-drag:hover { color: #5a5e78; }
.dhd-field-drag:active { cursor: grabbing; }

.dhd-field-name-wrap { min-width: 0; }
.dhd-field-name-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 13px;
  color: #2b2e48;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.dhd-field-name-input:hover { background: #f6f7fc; }
.dhd-field-name-input:focus {
  outline: none;
  border-color: rgba(124, 92, 246, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.13);
}

.dhd-field-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  height: 32px;
  width: 100%;
  border: 1px solid rgba(20, 20, 60, 0.09);
  border-radius: 8px;
  background: #f8f9fd;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 13px;
  color: #2b2e48;
  cursor: pointer;
  transition: all 0.15s ease;
  justify-content: space-between;
}
.dhd-field-type-btn:hover { background: #fff; border-color: rgba(20, 20, 60, 0.18); }
.dhd-field-type-btn:focus-visible { outline: none; border-color: rgba(124, 92, 246, 0.55); box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.13); }
.dhd-field-type-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.dhd-field-type-btn svg { color: #9296ad; flex-shrink: 0; }

.dhd-field-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; min-width: 0; justify-content: flex-end; }
.dhd-field-opt { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dhd-field-opt label { font-size: 11px; color: #9296ad; font-weight: 400; white-space: nowrap; }
.dhd-field-opt input {
  width: 70px;
  padding: 6px 8px;
  height: 32px;
  border: 1px solid rgba(20, 20, 60, 0.09);
  border-radius: 8px;
  background: #f8f9fd;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 12px;
  color: #2b2e48;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.dhd-field-opt input[type="text"] { width: 140px; }
.dhd-field-opt input:hover { border-color: rgba(20, 20, 60, 0.16); }
.dhd-field-opt input:focus {
  outline: none;
  border-color: rgba(124, 92, 246, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.13);
}

.dhd-field-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #c9ccdb;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.dhd-field-delete:hover { background: #fef2f2; color: #dc2626; }
.dhd-field-delete svg { width: 14px; height: 14px; }

.dhd-add-field-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px dashed rgba(20, 20, 60, 0.22);
  background: transparent;
  border-radius: 11px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 14px;
  font-weight: 500;
  color: #7b7f99;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 24px;
}
.dhd-add-field-btn:hover {
  border-color: rgba(124, 92, 246, 0.55);
  color: #5f3edd;
  background: rgba(124, 92, 246, 0.05);
}

.dhd-gen-options { padding-top: 24px; border-top: 1px solid rgba(20, 20, 60, 0.07); margin-bottom: 0; }

/* Preview table */
.dhd-preview-table-wrap { padding: 20px 24px; border-bottom: 1px solid rgba(20, 20, 60, 0.07); }
.dhd-preview-label {
  font-size: 11.5px;
  color: #9296ad;
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.dhd-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(20, 20, 60, 0.08);
  border-radius: 10px;
}
.dhd-preview-table { border-collapse: collapse; width: 100%; font-family: var(--font-mono, 'DM Mono', monospace); font-size: 12px; }
.dhd-preview-table thead { background: #f6f7fc; }
.dhd-preview-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #14142b;
  border-bottom: 1px solid rgba(20, 20, 60, 0.1);
  white-space: nowrap;
}
.dhd-preview-table td {
  padding: 8px 14px;
  color: #5a5e78;
  border-bottom: 1px solid rgba(20, 20, 60, 0.05);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dhd-preview-table tbody tr:last-child td { border-bottom: none; }
.dhd-preview-table tbody tr:hover { background: rgba(124, 92, 246, 0.045); }
.dhd-null-value { color: #b9bccc; font-style: italic; font-size: 11px; }

/* Raw output (data tool) — dark editor panel */
.dhd-raw-output { border-top: 1px solid rgba(20, 20, 60, 0.07); }
.dhd-raw-output summary {
  padding: 14px 24px;
  cursor: pointer;
  font-size: 13px;
  color: #7b7f99;
  user-select: none;
  background: #fafbfe;
  list-style: none;
}
.dhd-raw-output summary::-webkit-details-marker { display: none; }
.dhd-raw-output summary:hover { color: #2b2e48; }
.dhd-raw-output[open] summary { border-bottom: 1px solid rgba(20, 20, 60, 0.07); }
.dhd-preview-content {
  margin: 0;
  padding: 24px 28px;
  background: #14142b;
  color: #c8ccdf;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 500px;
  overflow-y: auto;
}

/* Modals (type picker, presets) */
.dhd-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: dht-fade-in 0.2s ease;
}
@keyframes dht-fade-in { from { opacity: 0; } to { opacity: 1; } }

.dhd-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 43, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dhd-modal-content {
  position: relative;
  background: #fff;
  border: 1px solid rgba(20, 20, 60, 0.1);
  border-radius: 18px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(20, 20, 60, 0.28);
  animation: dht-modal-slide 0.25s ease;
}
.dhd-modal-small { max-width: 520px; }
@keyframes dht-modal-slide { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.dhd-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(20, 20, 60, 0.07);
  flex-shrink: 0;
}
.dhd-modal-header h3 {
  font-family: var(--font-sans, 'DM Sans', sans-serif);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: #14142b;
}
.dhd-modal-close {
  background: transparent;
  border: none;
  padding: 4px;
  color: #9296ad;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.15s ease;
}
.dhd-modal-close:hover { color: #14142b; background: #f2f3fa; }

.dhd-modal-search {
  position: relative;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(20, 20, 60, 0.07);
  flex-shrink: 0;
}
.dhd-modal-search svg {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: #9296ad;
  pointer-events: none;
}
.dhd-modal-search input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  border: 1px solid rgba(20, 20, 60, 0.12);
  border-radius: 11px;
  background: #f8f9fd;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 14px;
  color: #2b2e48;
}
.dhd-modal-search input:focus {
  outline: none;
  border-color: rgba(124, 92, 246, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(124, 92, 246, 0.13);
}

.dhd-type-list { overflow-y: auto; padding: 8px 0; flex: 1 1 auto; min-height: 300px; }
.dhd-type-category {
  padding: 12px 20px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #9296ad;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.dhd-type-item {
  display: block;
  width: 100%;
  padding: 10px 20px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  font-family: var(--font-mono, 'DM Mono', monospace);
}
.dhd-type-item:hover { background: rgba(124, 92, 246, 0.07); }
.dhd-type-item-name { font-size: 14px; font-weight: 500; color: #2b2e48; margin-bottom: 2px; }
.dhd-type-item-desc { font-size: 12px; color: #7b7f99; line-height: 1.4; }

.dhd-preset-list { padding: 8px 0; overflow-y: auto; flex: 1 1 auto; }
.dhd-preset-item {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  font-family: var(--font-mono, 'DM Mono', monospace);
  border-bottom: 1px solid rgba(20, 20, 60, 0.05);
}
.dhd-preset-item:last-child { border-bottom: none; }
.dhd-preset-item:hover { background: rgba(124, 92, 246, 0.07); }
.dhd-preset-name { font-size: 14px; font-weight: 600; color: #14142b; margin-bottom: 4px; }
.dhd-preset-desc { font-size: 12px; color: #7b7f99; margin-bottom: 6px; }
.dhd-preset-fields { font-size: 11px; color: #9296ad; font-style: italic; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 900px) {
  :is(.dh-grid-3, .dhi-grid-3, .dhf-grid-3, .dhd-grid-3, .dh-grid-4) { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :is(.dh-controls, .dhi-controls, .dhf-controls, .dhd-controls) { padding: 20px; }
  :is(.dh-grid-2, .dhi-grid-2, .dhf-grid-2, .dh-grid-3, .dhi-grid-3, .dhf-grid-3, .dhd-grid-3, .dh-grid-4) { grid-template-columns: 1fr; }

  :is(.dh-actions-row, .dhi-actions-row, .dhf-actions-row, .dhd-actions-row) { flex-wrap: wrap; }
  :is(.dh-actions-row, .dhi-actions-row, .dhf-actions-row, .dhd-actions-row) :is(.dh-btn-ghost, .dhi-btn-ghost, .dhf-btn-ghost, .dhd-btn-ghost) { margin-left: 0; width: 100%; justify-content: center; }
  :is(.dh-btn-generate, .dhi-btn-generate, .dhf-btn-generate, .dhd-btn-generate) { flex: 1; justify-content: center; }

  :is(.dh-advanced, .dhi-advanced, .dhf-advanced, .dhd-advanced) { padding: 20px; }

  :is(.dh-toolbar, .dhi-toolbar, .dhf-toolbar, .dhd-toolbar) { flex-direction: column; gap: 12px; align-items: flex-start; padding: 16px 20px; }
  :is(.dh-toolbar-actions, .dhi-toolbar-actions, .dhf-toolbar-actions, .dhd-toolbar-actions) { width: 100%; flex-wrap: wrap; }
  :is(.dh-toolbar-actions, .dhi-toolbar-actions, .dhf-toolbar-actions, .dhd-toolbar-actions) :is(.dh-btn-tool, .dhi-btn-tool, .dhf-btn-tool, .dhd-btn-tool) { flex: 1; justify-content: center; }

  .dh-output { padding: 20px; }

  .dhd-field-row {
    grid-template-columns: 20px 1fr 28px;
    grid-template-areas:
      "drag name  delete"
      "drag type  type"
      "drag opts  opts";
    gap: 6px 8px;
    padding: 8px 10px;
    min-height: auto;
  }
  .dhd-field-drag { grid-area: drag; height: auto; align-self: stretch; }
  .dhd-field-name-wrap { grid-area: name; }
  .dhd-field-type-btn { grid-area: type; }
  .dhd-field-opts { grid-area: opts; justify-content: flex-start; flex-wrap: wrap; }
  .dhd-field-delete { grid-area: delete; }
  .dhd-header-row { flex-direction: column; align-items: stretch; }
  .dhd-header-actions { width: 100%; }
}

@media (max-width: 480px) {
  :is(.dh-controls, .dhi-controls, .dhf-controls, .dhd-controls) { padding: 16px; border-radius: 14px; }
  :is(.dh-advanced, .dhi-advanced, .dhf-advanced, .dhd-advanced) { padding: 16px; border-radius: 14px; }
  :is(.dh-output-panel, .dhi-output-panel, .dhf-output-panel, .dhd-output-panel) { border-radius: 14px; }
  :is(.dh-btn-generate, .dhi-btn-generate, .dhf-btn-generate, .dhd-btn-generate) { width: 100%; justify-content: center; }
  .dhd-modal { padding: 8px; }
  .dhd-modal-header { padding: 16px 20px; }
}
