/* devtoken.tools — csp-builder page styles (builds on style.css) */

/* ── Sticky output bar ── */
.output-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 12px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.output-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  overflow: hidden;
}

.output-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.output-box-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.output-box-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.output-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  padding: 10px 14px;
  word-break: break-all;
  line-height: 1.7;
  min-height: 44px;
}

.output-value.empty {
  color: var(--muted);
  font-style: italic;
  opacity: 0.5;
}

.output-char-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

/* ── Preset buttons ── */
.presets-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  align-items: center;
}

.preset-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.preset-btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.preset-btn:hover { border-color: var(--sig); color: var(--sig); opacity: 1; }

/* ── Directive sections ── */
.directive-section {
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

/* ── Directive card ── */
.directive-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.directive-card.active {
  border-color: var(--border2);
}

.directive-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}

.directive-header:hover { background: var(--bg3); }

.directive-enable {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.directive-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  flex: 1;
  transition: color 0.15s;
}

.directive-card.active .directive-name { color: var(--payload); }

.directive-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  flex: 2;
  line-height: 1.4;
}

.directive-preview {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.directive-card.active .directive-preview { color: var(--accent); }

/* ── Directive body (sources + options) ── */
.directive-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
}

.directive-card.active .directive-body { display: block; }
.directive-card.open    .directive-body { display: block; }

.sources-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 10px 0 6px;
}

/* Source chips (toggleable) */
.source-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.source-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  user-select: none;
}

.source-chip:hover { color: var(--text); opacity: 1; }

.source-chip.active {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: rgba(74,222,128,0.08);
}

.source-chip.danger {
  border-color: transparent;
  color: var(--muted);
}

.source-chip.danger.active {
  border-color: rgba(239,68,68,0.5);
  color: #fca5a5;
  background: rgba(239,68,68,0.08);
}

/* Custom source input */
.custom-source-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.custom-source-input {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
  min-height: auto;
}

.custom-source-add {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s;
}

.custom-source-add:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }

.custom-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.custom-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--payload);
}

.custom-tag-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  transition: color 0.1s;
}

.custom-tag-remove:hover { color: var(--danger); opacity: 1; }

/* ── Boolean-only directives ── */
.boolean-note {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  padding: 10px 0 4px;
  line-height: 1.5;
}

/* ── Warnings ── */
.csp-warning {
  display: none;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: #fcd34d;
  background: #1c1200;
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 4px;
  padding: 6px 10px;
}

.csp-warning.visible { display: block; }

/* ── Deployment formats ── */
.deploy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.deploy-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.deploy-card-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.deploy-card pre {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  margin-bottom: 6px;
}

@media (max-width: 640px) {
  .deploy-grid { grid-template-columns: 1fr; }
  .directive-desc { display: none; }
  .directive-preview { display: none; }
}

/* Replaces inline styles from the old page */
.deploy-panel { margin-top: 8px; }
.deploy-note { margin-top: 12px; line-height: 1.6; }
.code-sig { color: var(--sig-text); }
@media (max-width: 600px) {
  .preset-btn, .source-chip, .custom-tag-remove { width: auto; }
}

/* v2: header mode, import panel, kept directives */
.mode-label { margin-left: auto; }
.import-panel { margin-bottom: 24px; }
.import-panel > summary { cursor: pointer; list-style: none; }
.import-panel > summary::-webkit-details-marker { display: none; }
.import-panel > summary::after { content: '+'; font-family: var(--mono); color: var(--muted); margin-left: auto; }
.import-panel[open] > summary::after { content: '−'; }
.import-panel textarea { font-family: var(--mono); font-size: 13px; width: 100%; margin: 6px 0 12px; }
.extra-directives { margin: -8px 0 24px; }
.extra-directives .custom-tags { margin: 0; }
@media (max-width: 600px) { .mode-label { margin-left: 0; } }
