/* Form page only */

/* ── Saved configuration preset picker ── */
.preset-bar {
  padding: 1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    165deg,
    rgba(14, 165, 233, 0.06) 0%,
    rgba(255, 255, 255, 0.4) 55%
  );
}

.preset-bar-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.preset-bar-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.22);
}

.preset-bar-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text2);
}

.preset-bar-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.preset-select {
  position: relative;
}

.preset-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  text-align: left;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  font-family: 'Inter', sans-serif;
}

.preset-trigger:hover {
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.1);
}

.preset-select.is-open .preset-trigger {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.preset-trigger-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.preset-trigger-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-trigger-desc {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preset-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.preset-select.is-open .preset-chevron {
  transform: rotate(180deg);
  color: var(--cyan);
}

.preset-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: min(320px, 50vh);
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--r-sm);
  box-shadow:
    0 16px 40px rgba(15, 23, 42, 0.12),
    0 4px 12px rgba(15, 23, 42, 0.06);
  padding: 0.35rem;
  animation: presetMenuIn 0.18s ease;
}

@keyframes presetMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.preset-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: background var(--t);
}

.preset-option:hover {
  background: rgba(14, 165, 233, 0.08);
}

.preset-option.is-selected {
  background: rgba(14, 165, 233, 0.12);
}

.preset-option.is-selected .preset-option-label::after {
  content: ' ✓';
  color: #0369a1;
  font-weight: 700;
}

.preset-option-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
}

.preset-option-desc {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
}

.preset-applied {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.55rem 0 0;
  font-size: 0.68rem;
  color: #047857;
}

.preset-applied-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

.preset-applied--pulse {
  animation: presetFlash 0.35s ease;
}

@keyframes presetFlash {
  0% { opacity: 0.4; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

.page-form .form-card {
  animation: fadeUp 0.55s ease 0.08s both;
}

.page-form .hero {
  text-align: center;
  margin-bottom: 2.75rem;
  animation: fadeUp 0.55s ease both;
}

.page-form .hero p {
  font-size: 0.92rem;
  max-width: 480px;
  margin: 0 auto;
}

.layout {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

.btn-run {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 0.875rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(37, 99, 235, 0.18));
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--r-sm);
  color: #0369a1;
  font-family: 'Inter', sans-serif; font-size: 0.88rem; font-weight: 600;
  letter-spacing: 0.04em; cursor: pointer;
  transition: all var(--t); position: relative; overflow: hidden;
}

.btn-run::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), transparent);
  opacity: 0; transition: opacity var(--t);
}

.btn-run:hover {
  border-color: var(--cyan);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.btn-run:hover::after { opacity: 1; }
.btn-run:active { transform: translateY(0); box-shadow: none; }
.btn-run .btn-icon { font-size: 1rem; }

.btn-run.loading .btn-text::after {
  content: ''; display: inline-block;
  width: 12px; height: 12px; margin-left: 8px;
  border: 2px solid rgba(14, 165, 233, 0.35);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.viz-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  backdrop-filter: blur(10px);
  position: sticky; top: 74px;
  animation: fadeUp 0.55s ease 0.15s both;
}

.viz-hdr {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.viz-title {
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text2);
  display: flex; align-items: center; gap: 7px;
}

.viz-hint { font-size: 0.68rem; color: var(--muted); font-style: italic; }

.viz-canvas {
  padding: 1.25rem;
  aspect-ratio: 12 / 10;
  min-height: 280px;
  max-height: 480px;
}

#viz-svg { width: 100%; height: 100%; display: block; }

.viz-canvas-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.25rem;
}

.viz-canvas-wrap .viz-canvas {
  flex: 1 1 auto;
  padding: 0;
}

.viz-side-strip {
  width: 260px;
  flex: 0 0 260px;
  align-self: center;
  display: none;
  align-items: center;
  justify-content: center;
}

.viz-side-strip-card {
  width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  display: block;
}

.viz-side-strip.open { display: flex; }

.viz-side-strip #ssDemoSvg {
  width: 100%;
  height: auto;
  min-height: 60px;
}

.viz-dims {
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0;
}

.dim-col {
  padding: 0.7rem 1rem; text-align: center;
  border-right: 1px solid var(--border);
}

.dim-col:last-child { border-right: none; }

.dim-lbl {
  font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); margin-bottom: 3px;
}

.dim-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem; font-weight: 500;
}

.dv-green { color: var(--green); }
.dv-blue  { color: var(--blue);  }
.dv-cyan  { color: var(--cyan);  }
.dv-amber { color: #b45309; }

.viz-legend {
  border-top: 1px solid var(--border);
  display: flex; gap: 1.2rem; flex-wrap: wrap;
  padding: 0.65rem 1.25rem;
}

.leg {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.68rem; color: var(--text2);
}

.leg-sq {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
}

.leg-ci {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
