/* ═══════════════════════════════════════════════════════════════
   TRIO Beregner – Frontend CSS
   ═══════════════════════════════════════════════════════════════ */

/* ─── Reset & base ─────────────────────────────────────────────── */
.trio-beregner {
  font-family: var(--trio-font, 'Sora', system-ui, sans-serif);
  background: var(--trio-bg, #ffffff);
  color: #14213d;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08), 0 1px 4px rgba(15, 23, 42, 0.04);
  padding: 32px;
  max-width: 100%;
  position: relative;
}

.trio-beregner * {
  box-sizing: border-box;
}

/* ─── Intro / beskrivelse (ingen tittel) ───────────────────────── */
.trio-beregner__intro {
  margin-bottom: 24px;
}

.trio-beregner__intro p {
  margin: 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.6;
}

/* ─── Step-indikator ───────────────────────────────────────────── */
.trio-beregner__steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  flex-wrap: nowrap;
  overflow: hidden;
}

/* Step-badge er KUN visuel – ikke klikbar */
.trio-step-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
  user-select: none;
  pointer-events: none;         /* Ikke klikbar */
  transition: background 0.25s ease, color 0.25s ease;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.trio-step-badge__num {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #94a3b8;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

.trio-step-badge__checkmark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.trio-step-badge__number {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.trio-step-badge__label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Aktiv step */
.trio-step-badge.is-active {
  background: var(--trio-primary, #1f4ed8);
  color: #ffffff;
}

.trio-step-badge.is-active .trio-step-badge__num {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Afsluttet step – vis checkmark */
.trio-step-badge.is-completed {
  background: #dcfce7;
  color: #166534;
}

.trio-step-badge.is-completed .trio-step-badge__num {
  background: #16a34a;
  color: #ffffff;
}

.trio-step-badge.is-completed .trio-step-badge__checkmark {
  opacity: 1;
  transform: scale(1);
}

.trio-step-badge.is-completed .trio-step-badge__number {
  opacity: 0;
  transform: scale(0.6);
}

/* Låst / fremtidigt step */
.trio-step-badge.is-locked {
  opacity: 0.5;
}

/* Connector-linje mellem badges */
.trio-step-connector {
  flex: 1;
  height: 2px;
  background: #e2e8f0;
  min-width: 8px;
  max-width: 32px;
  flex-shrink: 1;
}

/* ─── Steps (formular-sektioner) ────────────────────────────────── */
.trio-step {
  display: none;
  animation: trio-step-in 0.25s ease;
}

.trio-step.is-active {
  display: block;
}

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

@keyframes trio-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.trio-shake {
  animation: trio-shake 0.4s ease;
}

/* ─── Felter ────────────────────────────────────────────────────── */
.trio-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 8px;
}

.trio-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.trio-field label {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
}

.trio-field__req {
  color: var(--trio-primary, #1f4ed8);
  font-size: 12px;
}

.trio-field input:not([type="range"]):not([type="radio"]):not([type="checkbox"]),
.trio-field select,
.trio-field textarea {
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 13px 15px;
  font: inherit;
  font-size: 15px;
  background: #ffffff;
  color: #1e293b;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.trio-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='4 6 8 10 12 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.trio-field input:focus,
.trio-field select:focus,
.trio-field textarea:focus {
  outline: none;
  border-color: var(--trio-primary, #1f4ed8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--trio-primary, #1f4ed8) 15%, transparent);
}

.trio-field textarea {
  resize: vertical;
  min-height: 100px;
}

/* Slider */
.trio-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trio-field input[type="range"] {
  width: 100%;
  height: 6px;
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--trio-primary, #1f4ed8);
  cursor: pointer;
}

.trio-live-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--trio-primary, #1f4ed8);
}

/* Radio / Yes-No options */
.trio-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trio-option {
  position: relative;
  cursor: pointer;
}

.trio-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.trio-option span {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.trio-option:hover span {
  border-color: var(--trio-primary, #1f4ed8);
  background: color-mix(in srgb, var(--trio-primary, #1f4ed8) 6%, white);
}

.trio-option input:checked + span {
  background: var(--trio-primary, #1f4ed8);
  border-color: var(--trio-primary, #1f4ed8);
  color: #ffffff;
}

.trio-options--yesno .trio-option span {
  min-width: 80px;
  justify-content: center;
}

/* Checkbox */
.trio-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.trio-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--trio-primary, #1f4ed8);
  cursor: pointer;
  flex-shrink: 0;
}

/* Validering */
.trio-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

/* ─── Navigation ────────────────────────────────────────────────── */
.trio-beregner__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  gap: 12px;
}

.trio-beregner__nav-right {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* ─── Knapper ───────────────────────────────────────────────────── */
.trio-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  appearance: none;
  border: none;
  background: var(--trio-primary, #1f4ed8);
  color: #ffffff;
  padding: 13px 22px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease;
  text-decoration: none;
  line-height: 1;
}

.trio-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.trio-btn:active:not(:disabled) {
  transform: translateY(0);
}

.trio-btn:disabled,
.trio-btn--loading {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.trio-btn-secondary {
  background: #f1f5f9;
  color: #334155;
}

.trio-btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
  opacity: 1;
}

/* Pill-stil */
.trio-btn-pill .trio-btn {
  border-radius: 999px;
}

/* Square-stil */
.trio-btn-square .trio-btn {
  border-radius: 6px;
}

/* ─── Besked / fejl ─────────────────────────────────────────────── */
.trio-beregner__message {
  margin-top: 16px;
  font-size: 14px;
  font-weight: 600;
  min-height: 20px;
}

.trio-message--error {
  color: #dc2626;
}

.trio-message--success {
  color: #16a34a;
}

/* ─── Resultat-skærm ────────────────────────────────────────────── */
.trio-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0 4px;
  animation: trio-result-in 0.4s ease;
}

@keyframes trio-result-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.trio-result__icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.trio-result__icon svg {
  width: 30px;
  height: 30px;
}

.trio-result__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.trio-result__thanks {
  margin: 0;
  font-size: 16px;
  color: #475569;
  max-width: 360px;
  line-height: 1.6;
}

.trio-result__price-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 340px;
}

.trio-result__price-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trio-price {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  color: var(--trio-primary, #1f4ed8);
  letter-spacing: -0.02em;
}

.trio-result-text {
  margin: 4px 0 0;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

/* ─── Layout: Split ─────────────────────────────────────────────── */
.trio-layout-split .trio-beregner__inner {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 32px;
  align-items: start;
}

.trio-layout-split .trio-result {
  position: sticky;
  top: 0;
}

/* ─── Layout: Minimal ───────────────────────────────────────────── */
.trio-layout-minimal {
  box-shadow: none;
  border-color: transparent;
  padding: 0;
  background: transparent;
}

.trio-layout-minimal .trio-step-badge {
  background: transparent;
  border: 1.5px solid #e2e8f0;
}

/* ─── Layout: Progress ──────────────────────────────────────────── */
.trio-layout-progress .trio-beregner__steps {
  flex-wrap: nowrap;
  overflow: visible;
}

.trio-layout-progress .trio-step-badge {
  flex: 1;
  justify-content: center;
}

/* ─── Compact ───────────────────────────────────────────────────── */
.trio-layout-compact {
  padding: 20px;
  border-radius: 14px;
}

.trio-layout-compact .trio-fields {
  grid-template-columns: 1fr;
  gap: 14px;
}

/* ─── Kort-designvarianter ──────────────────────────────────────── */
.trio-card-outlined {
  box-shadow: none;
  border-width: 2px;
}

.trio-card-glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, 0.6);
}

/* ─── Tom state ─────────────────────────────────────────────────── */
.trio-empty {
  padding: 32px;
  text-align: center;
  color: #64748b;
}

.trio-empty p {
  margin: 0;
}

/* ─── Responsivt ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .trio-beregner {
    padding: 20px 18px;
    border-radius: 16px;
  }

  .trio-beregner__steps {
    gap: 0;
    margin-bottom: 20px;
  }

  .trio-step-badge__label {
    display: none;           /* Skjul labels på mobil – vis kun numre */
  }

  .trio-step-badge {
    padding: 8px 10px;
  }

  .trio-step-connector {
    min-width: 4px;
    max-width: 16px;
  }

  .trio-fields {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .trio-beregner__nav {
    margin-top: 20px;
  }

  .trio-layout-split .trio-beregner__inner {
    display: block;
  }

  .trio-result__price-card {
    padding: 20px;
  }

  .trio-price {
    font-size: 36px;
  }
}

@media (max-width: 400px) {
  .trio-beregner {
    padding: 16px 14px;
  }

  .trio-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}
