/* ── Star schema builder — Data journey #3 ─────────────────────── */
/* Step-by-step exercise: one panel on top, growing schema below. */

.starschema-section { margin-top: 1rem; }

/* Progress strip */
.starschema-progress {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  counter-reset: ssp;
}

.starschema-progress li {
  font-family: 'Kalam', cursive;
  font-size: 0.78rem;
  color: #aaa;
  padding: 0.18rem 0.55rem;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  background: transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.starschema-progress li.done {
  color: #2B2B2B;
  border-color: rgba(0, 0, 0, 0.28);
}

.starschema-progress li.active {
  color: #0ea5a4;
  border-color: #0ea5a4;
  background: rgba(14, 165, 164, 0.08);
}

/* Panel host */
.starschema-panel-host {
  margin-bottom: 1.6rem;
}

.starschema-panel {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 1rem 1.2rem 1.2rem;
  background: rgba(0, 0, 0, 0.012);
  animation: starschemaFade 0.35s ease;
}

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

.starschema-stage-title {
  font-family: 'Kalam', cursive;
  font-weight: 700;
  font-size: 0.92rem;
  color: #0ea5a4;
  letter-spacing: 0.03em;
  margin: 0 0 0.6rem;
}

.starschema-prompt {
  font-family: 'Kalam', cursive;
  font-size: 1rem;
  color: #2B2B2B;
  margin: 0 0 0.9rem;
  line-height: 1.45;
}

.starschema-list-label {
  font-family: 'Kalam', cursive;
  font-style: italic;
  font-size: 0.9rem;
  color: #6e6e6e;
  margin: 0 0 0.4rem;
}

/* Reporting question box */
.starschema-question {
  border: 1px dashed rgba(0, 0, 0, 0.2);
  background: rgba(14, 165, 164, 0.05);
  padding: 0.7rem 0.95rem;
  margin: 0 0 0.9rem;
  border-radius: 3px;
}

.starschema-question .label {
  display: block;
  font-family: 'Kalam', cursive;
  font-weight: 700;
  font-size: 0.78rem;
  color: #0ea5a4;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.starschema-question .text {
  font-family: 'Kalam', cursive;
  font-size: 1rem;
  color: #2B2B2B;
  margin: 0;
  line-height: 1.45;
}

/* Domain selector */
.starschema-domain-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 0.4rem 0 1rem;
}

.starschema-domain-btn {
  font-family: 'Kalam', cursive;
  font-size: 1rem;
  border: 1.5px solid rgba(0, 0, 0, 0.2);
  border-radius: 22px;
  padding: 0.5rem 0.7rem;
  background: transparent;
  cursor: pointer;
  color: #2B2B2B;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.4;
  text-align: center;
}

.starschema-domain-btn:hover {
  border-color: #0ea5a4;
  color: #0ea5a4;
}

.starschema-domain-btn.active {
  background: #0ea5a4;
  border-color: #0ea5a4;
  color: #fff;
}

/* Step 3: multi-select chip checklist */
.starschema-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.2rem 0 0.9rem;
}

.starschema-toggle {
  font-family: 'Kalam', cursive;
  font-size: 0.95rem;
  padding: 0.3rem 0.75rem 0.3rem 1.65rem;
  border: 1.4px solid rgba(0, 0, 0, 0.22);
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  color: #2B2B2B;
  position: relative;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.starschema-toggle::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 50%;
  width: 0.85rem;
  height: 0.85rem;
  border: 1.4px solid rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  transform: translateY(-50%);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.starschema-toggle:hover:not(:disabled) {
  border-color: #0ea5a4;
  color: #0ea5a4;
}

.starschema-toggle:hover:not(:disabled)::before {
  border-color: #0ea5a4;
}

.starschema-toggle.selected {
  border-color: #0ea5a4;
  color: #0ea5a4;
}

.starschema-toggle.selected::before {
  background: #0ea5a4;
  border-color: #0ea5a4;
  box-shadow: inset 0 0 0 2px #fff;
}

.starschema-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Steps 4–6: assign rows with dropdown */
.starschema-assign-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  margin: 0.3rem 0 0.9rem;
}

.starschema-assign-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.starschema-assign-row:last-child { border-bottom: 0; }

.starschema-assign-label {
  font-family: 'Kalam', cursive;
  font-size: 0.95rem;
  color: #2B2B2B;
}

.starschema-select {
  font-family: 'Kalam', cursive;
  font-size: 0.92rem;
  padding: 0.3rem 0.5rem;
  border: 1.2px solid rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  background: #fff;
  color: #2B2B2B;
  cursor: pointer;
  transition: border-color 0.15s;
}

.starschema-select:hover:not(:disabled),
.starschema-select:focus { border-color: #0ea5a4; outline: none; }

.starschema-select:disabled { opacity: 0.7; cursor: not-allowed; }

/* Feedback */
.starschema-feedback {
  font-family: 'Kalam', cursive;
  font-size: 0.95rem;
  margin: 0.6rem 0 0.4rem;
  min-height: 1.3em;
}

.starschema-feedback.correct {
  color: #0ea5a4;
}

.starschema-feedback.incorrect {
  color: #c0392b;
}

/* Actions */
.starschema-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.starschema-action-btn {
  font-family: 'Kalam', cursive;
  font-size: 0.95rem;
  border: 1.5px solid rgba(0, 0, 0, 0.22);
  border-radius: 22px;
  padding: 0.4rem 1rem;
  background: transparent;
  cursor: pointer;
  color: #2B2B2B;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.starschema-action-btn:hover:not(:disabled) {
  border-color: #0ea5a4;
  color: #0ea5a4;
}

.starschema-action-btn.primary {
  border-color: #0ea5a4;
  color: #0ea5a4;
}

.starschema-action-btn.primary:hover:not(:disabled) {
  background: #0ea5a4;
  color: #fff;
}

.starschema-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.starschema-action-btn.ghost {
  border-style: dashed;
  border-color: rgba(0, 0, 0, 0.25);
  color: #6e6e6e;
  font-style: italic;
}

.starschema-action-btn.ghost:hover:not(:disabled) {
  border-style: solid;
  border-color: #0ea5a4;
  color: #0ea5a4;
  font-style: normal;
}

/* ── Schema area ──────────────────────────────────────────────── */
.starschema-schema-wrap {
  border-top: 1px dashed rgba(0, 0, 0, 0.18);
  padding-top: 1rem;
  margin-top: 0.4rem;
}

.starschema-schema-title {
  font-family: 'Kalam', cursive;
  font-weight: 700;
  font-size: 0.9rem;
  color: #0ea5a4;
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem;
  text-transform: uppercase;
}

.starschema-schema-hint {
  font-family: 'Kalam', cursive;
  font-style: italic;
  color: #bbb;
  font-size: 0.92rem;
  margin: 0.2rem 0 0;
}

.starschema-canvas {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.9rem;
  align-items: stretch;
  margin-top: 0.4rem;
}

.starschema-canvas[hidden] { display: none; }

.ss-table {
  border: 1.2px solid rgba(0, 0, 0, 0.28);
  border-radius: 3px;
  padding: 0.55rem 0.7rem;
  background: #fbfaf5;
  min-height: 80px;
  position: relative;
  z-index: 1;
  animation: ssBoxIn 0.35s ease;
}

@keyframes ssBoxIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.ss-table .name {
  display: block;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #2B2B2B;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.18);
  padding-bottom: 0.25rem;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.ss-table ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ss-table li {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.76rem;
  color: #2B2B2B;
  padding: 0.08rem 0;
  line-height: 1.35;
}

.ss-table li.key { color: #0ea5a4; font-weight: 700; }
.ss-table li.calc {
  font-style: italic;
  color: #8c6e3a;
  font-size: 0.74rem;
}

.ss-keytag {
  font-family: 'Kalam', cursive;
  font-style: italic;
  font-size: 0.7rem;
  color: #8c6e3a;
  font-weight: 400;
}

.ss-fact {
  background: rgba(14, 165, 164, 0.06);
  border-color: #0ea5a4;
  border-width: 1.6px;
}

.ss-fact .name { color: #0ea5a4; }

.ss-section-label {
  display: block;
  font-family: 'Kalam', cursive;
  font-size: 0.7rem;
  color: #999;
  letter-spacing: 0.04em;
  margin: 0.45rem 0 0.15rem;
  text-transform: uppercase;
}

.ss-section-label:first-of-type { margin-top: 0.25rem; }

.ss-empty {
  font-family: 'Kalam', cursive;
  font-size: 0.78rem;
  font-style: italic;
  color: #bbb;
}

/* Grid positions */
.ss-pos-tl { grid-column: 1; grid-row: 1; }
.ss-pos-tc { grid-column: 2; grid-row: 1; }
.ss-pos-tr { grid-column: 3; grid-row: 1; }
.ss-pos-cl { grid-column: 1; grid-row: 2; }
.ss-pos-cc { grid-column: 2; grid-row: 2; }
.ss-pos-cr { grid-column: 3; grid-row: 2; }
.ss-pos-bl { grid-column: 1; grid-row: 3; }
.ss-pos-bc { grid-column: 2; grid-row: 3; }
.ss-pos-br { grid-column: 3; grid-row: 3; }

/* Relationship lines */
.starschema-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

.starschema-lines line {
  stroke: #0ea5a4;
  stroke-width: 1;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.starschema-lines.show line { opacity: 0.55; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 720px) {
  .starschema-domain-selector {
    grid-template-columns: repeat(2, 1fr);
  }

  .starschema-assign-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .starschema-canvas {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .ss-pos-tl, .ss-pos-tc, .ss-pos-tr,
  .ss-pos-cl, .ss-pos-cc, .ss-pos-cr,
  .ss-pos-bl, .ss-pos-bc, .ss-pos-br {
    grid-column: 1;
    grid-row: auto;
  }

  .starschema-lines { display: none; }
}
