/* CBAM Calculator - custom styles (complements css/tailwind.css) */

:root {
  --c-ink: #0f172a;
  --c-muted: #64748b;
  --c-line: #e2e8f0;
  --c-default: #475569;
  --c-actual: #059669;
  --c-focus: #94a3b8;
}

/* ---------- form ---------- */
fieldset { min-width: 0; }
.step-legend {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .375rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--c-ink);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 9999px;
  background: var(--c-ink);
  color: #fff;
  font-size: .75rem;
}
.field-label {
  display: block;
  margin-bottom: .25rem;
  font-size: .8125rem;
  font-weight: 500;
  color: #334155;
}
.field-input {
  display: block;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: .5rem;
  background: #fff;
  padding: .5rem .75rem;
  font-size: .875rem;
  color: var(--c-ink);
}
.field-input:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .35);
}
.field-input.is-invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, .2);
}
.radio-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  border: 1px solid #cbd5e1;
  border-radius: .5rem;
  padding: .375rem .5rem;
  cursor: pointer;
  user-select: none;
}
.radio-pill:has(input:checked) {
  border-color: var(--c-ink);
  background: #f1f5f9;
  font-weight: 600;
}
.radio-pill input { accent-color: var(--c-ink); }

.advanced > summary { list-style: none; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "▸"; margin-right: .5rem; color: var(--c-muted); transition: transform .15s; }
.advanced[open] > summary::before { transform: rotate(90deg); }
.advanced > summary { justify-content: flex-start; }
.advanced > summary #advanced-summary { margin-left: auto; }

/* ---------- combobox ---------- */
.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 20rem;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: .5rem;
  background: #fff;
  box-shadow: 0 10px 25px -10px rgba(15, 23, 42, .25);
  padding: .25rem 0;
}
.combo-option {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: .75rem;
  padding: .4rem .75rem;
  font-size: .875rem;
  cursor: pointer;
  min-width: 0;
}
.combo-option.active, .combo-option:hover { background: #f1f5f9; }
.combo-group { padding: .5rem .75rem .25rem; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); }
.combo-empty, .combo-footer { padding: .5rem .75rem; font-size: .75rem; color: var(--c-muted); }
.combo-footer { border-top: 1px solid var(--c-line); }
.combo-desc {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
  font-size: .75rem;
  color: #475569;
}
.combo-option > .font-mono { flex-shrink: 0; min-width: 4.75rem; }

/* ---------- one-line descriptions ---------- */
#cn-match { display: flex; align-items: baseline; gap: .5rem; min-width: 0; min-height: 1rem; }
.desc-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; color: #334155; flex-shrink: 0; }
.desc-line { display: flex; align-items: baseline; gap: .375rem; min-width: 0; flex: 1; }
.desc-text { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.desc-line.expanded .desc-text { white-space: normal; overflow: visible; }
.desc-toggle { flex-shrink: 0; font-size: .6875rem; font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: 2px; opacity: .8; }
.desc-toggle[hidden] { display: none; }

/* ---------- results ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  border-radius: 9999px;
  padding: .125rem .625rem;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.num { font-variant-numeric: tabular-nums; }

.taric-chip { position: relative; cursor: help; }
.taric-chip:focus { outline: 2px solid currentColor; outline-offset: 2px; }
.taric-chip .tooltip {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 6px);
  width: 16rem;
  padding: .5rem .625rem;
  border-radius: .5rem;
  background: var(--c-ink);
  color: #fff;
  font-size: .75rem;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  box-shadow: 0 10px 25px -10px rgba(15, 23, 42, .4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s;
  pointer-events: none;
}
.taric-chip:hover .tooltip, .taric-chip:focus .tooltip, .taric-chip:focus-within .tooltip { opacity: 1; visibility: visible; }

.data-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.data-table th, .data-table td { padding: .5rem .625rem; border-bottom: 1px solid var(--c-line); text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { font-weight: 600; color: var(--c-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.data-table tr.total td { font-weight: 700; color: var(--c-ink); border-top: 2px solid var(--c-ink); }
.data-table .formula { display: block; color: var(--c-muted); font-size: .6875rem; font-weight: 400; }

.steps-pre {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem;
  line-height: 1.5;
  color: #334155;
}

.savings-highlight {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7 !important;
}

.accordion > summary, .notes > summary { list-style: none; }
.accordion > summary::-webkit-details-marker, .notes > summary::-webkit-details-marker { display: none; }
.accordion > summary::after, .notes > summary::after { content: "▾"; color: var(--c-muted); transition: transform .15s; }
.accordion[open] > summary::after, .notes[open] > summary::after { transform: rotate(180deg); }
.notes > summary { gap: .75rem; }
.notes > summary > span { margin-left: auto; }

/* ---------- paywall ---------- */
.pro-locked { position: relative; min-height: 34rem; border-radius: .75rem; overflow: hidden; }
.pro-blur {
  filter: blur(5px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
.pro-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, .35) 0%, rgba(248, 250, 252, .75) 100%);
}
.unlock-card {
  width: 100%;
  max-width: 26rem;
  border: 1px solid var(--c-line);
  border-radius: .875rem;
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 20px 45px -20px rgba(15, 23, 42, .35);
}
.price-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  padding: .25rem .75rem;
  font-size: .875rem;
  font-weight: 700;
  color: #047857;
}
.unlock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  border-radius: .5rem;
  background: var(--c-ink);
  padding: .625rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: #fff;
}
.unlock-btn:hover { background: #1e293b; }
.unlock-btn[disabled] { background: #94a3b8; cursor: not-allowed; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal-panel { position: relative; width: 100%; max-width: 26rem; }
.modal-panel .unlock-card { max-width: none; }
.modal-close {
  position: absolute;
  top: .5rem;
  right: .75rem;
  z-index: 1;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--c-muted);
}
.modal-close:hover { color: var(--c-ink); }
body.modal-open { overflow: hidden; }

/* ---------- print / PDF (Pro only; free users get the unlock modal) ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; font-size: 11px; }
  .no-print, #results-empty, .modal, .desc-toggle { display: none !important; }
  main { display: block !important; padding: 0 !important; }
  #results { width: 100% !important; }
  .shadow-sm { box-shadow: none !important; }
  .desc-text { white-space: normal !important; overflow: visible !important; }
  #chart { height: 240px !important; break-inside: avoid; }
  #status-card, .pro-card, #disclaimers { break-inside: avoid; }
  details > summary { list-style: none; }
  details:not([open]) > *:not(summary) { display: block !important; }
  body:not(.is-pro) #pro-area { display: none !important; }
  .taric-chip .tooltip { display: none !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9px; color: var(--c-muted); }
}

/* ---------- legal pages (impressum.html, datenschutz.html) ---------- */
.legal-page h1 { font-size: 1.5rem; font-weight: 600; color: var(--c-ink); margin: 1.5rem 0 1rem; }
.legal-page h2 { font-size: 1rem; font-weight: 600; color: var(--c-ink); margin: 1.5rem 0 .5rem; }
.legal-page p, .legal-page li { font-size: .9375rem; line-height: 1.6; margin-bottom: .5rem; }
.legal-page ul { list-style: disc; padding-left: 1.25rem; margin-bottom: .75rem; }
.placeholder-banner { border: 1px solid #fcd34d; background: #fffbeb; color: #78350f; border-radius: .75rem; padding: .875rem 1rem; font-size: .875rem; }
mark.ph { background: #fef3c7; color: #92400e; border-radius: .25rem; padding: 0 .25rem; }

/* ---------- payment flow ---------- */
.spinner {
  width: 1.75rem; height: 1.75rem; border-radius: 9999px;
  border: 3px solid #e2e8f0; border-top-color: #0f172a; animation: cbam-spin .8s linear infinite;
}
@keyframes cbam-spin { to { transform: rotate(360deg); } }
.kpi-locked { cursor: pointer; }
.unlock-btn:disabled { background: #94a3b8; cursor: wait; }
