/* ============================================================
   Resepolicy Generator – resepolicy.css
   Neutral, minimalistisk bas. Alla element taggade med
   rp-* klasser för enkel anpassning.
   ============================================================ */

/* ── Wrapper ───────────────────────────────────────────────── */
.rp-wizard {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
}

/* ── Steg-synlighet ─────────────────────────────────────────── */
.rp-step {
  display: block;
}
.rp-step--hidden {
  display: none;
}

/* ── Progress ───────────────────────────────────────────────── */
.rp-progress {
  margin-bottom: 2rem;
}
.rp-progress-track {
  height: 4px;
  background: #e5e5e5;
  border-radius: 2px;
  overflow: hidden;
}
.rp-progress-fill {
  height: 100%;
  background: currentColor;
  opacity: 0.35;
  transition: width 0.3s ease;
}
.rp-progress-label {
  font-size: 0.8rem;
  color: #888;
  margin: 0.4rem 0 0;
}

/* ── Steg-rubrik ────────────────────────────────────────────── */
.rp-step-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e5e5;
}
.rp-step-header--result {
  border-bottom: none;
  padding-bottom: 0;
}
.rp-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.4;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
}
.rp-step-title {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
  font-weight: 600;
}
.rp-step-desc {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.65;
}

/* ── Step body ──────────────────────────────────────────────── */
.rp-step-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Fält ───────────────────────────────────────────────────── */
.rp-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.rp-field--inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.rp-field--indented {
  margin-left: 1.75rem;
  margin-top: 0.35rem;
}
.rp-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  background: #f9f9f9;
  border-radius: 4px;
  border-left: 3px solid #e0e0e0;
}
.rp-field-hint {
  font-size: 0.8rem;
  opacity: 0.6;
  margin: 0;
}

/* ── Labels ─────────────────────────────────────────────────── */
.rp-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}
.rp-label--group {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.55;
  margin-bottom: 0.15rem;
}
.rp-label-hint {
  font-weight: 400;
  opacity: 0.6;
}
.rp-required {
  color: inherit;
  opacity: 0.5;
}
.rp-legend {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding: 0;
}
.rp-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rp-fieldset--inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.rp-subsection-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.5;
  margin: 0.5rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e5e5;
}

/* ── Inputs ─────────────────────────────────────────────────── */
.rp-input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  transition: border-color 0.15s;
}
.rp-input:focus {
  outline: none;
  border-color: currentColor;
  opacity: 1;
}
.rp-input--short {
  width: 80px;
  flex-shrink: 0;
}
.rp-inline-input-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.rp-input-suffix {
  font-size: 0.9rem;
  opacity: 0.7;
  white-space: nowrap;
}
.rp-select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  width: 100%;
  cursor: pointer;
}
.rp-textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

/* ── Radio & Checkbox ───────────────────────────────────────── */
.rp-checkbox-label,
.rp-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1.45;
}
.rp-radio-label--inline {
  flex-direction: row;
  align-items: center;
}
.rp-checkbox,
.rp-radio {
  flex-shrink: 0;
  margin-top: 0.2rem;
  cursor: pointer;
  accent-color: currentColor;
}

/* ── Conditional reveal ─────────────────────────────────────── */
.rp-conditional {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 1.75rem;
  margin-top: 0.3rem;
}
.rp-conditional--hidden {
  display: none;
}

/* ── Notice ─────────────────────────────────────────────────── */
.rp-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: #fefbec;
  border: 1px solid #e8d96a;
  border-radius: 4px;
  font-size: 0.88rem;
  line-height: 1.5;
}
.rp-notice--hidden {
  display: none;
}
.rp-notice-icon {
  flex-shrink: 0;
}

/* ── Sortable lists ─────────────────────────────────────────── */
.rp-sortable {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.rp-sortable-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 0.9rem;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.1s, border-color 0.1s;
}
.rp-sortable-item:active {
  cursor: grabbing;
}
.rp-sortable-item.sortable-ghost {
  opacity: 0.4;
  border-style: dashed;
}
.rp-sortable-item.sortable-chosen {
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border-color: #999;
}
.rp-drag-handle {
  opacity: 0.3;
  font-size: 1rem;
  line-height: 1;
}

/* ── Navigation ─────────────────────────────────────────────── */
.rp-step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e5e5;
  gap: 0.75rem;
}
.rp-step-nav--right {
  justify-content: flex-end;
}

/* ── Buttons ────────────────────────────────────────────────── */
.rp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.rp-btn--primary {
  background: currentColor;
  color: inherit;
  border-color: currentColor;
  /* Text color via filter so it's visible on any bg */
}
/* Trick: use a wrapper to ensure button text contrasts */
.rp-btn--primary {
  background: #222;
  color: #fff;
  border-color: #222;
}
.rp-btn--primary:hover {
  opacity: 0.85;
}
.rp-btn--ghost {
  background: transparent;
  color: inherit;
  border-color: #ccc;
}
.rp-btn--ghost:hover {
  border-color: #999;
}
.rp-btn--print {
  background: transparent;
  color: inherit;
  border-color: #ccc;
}
.rp-btn--print:hover {
  border-color: #999;
}

/* ── Result actions ─────────────────────────────────────────── */
.rp-result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.rp-result-actions--bottom {
  margin-top: 2rem;
  margin-bottom: 0;
  padding-top: 1.25rem;
  border-top: 1px solid #e5e5e5;
}

/* ── Screen reader only ─────────────────────────────────────── */
.rp-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════
   POLICY OUTPUT – genererad policydokument
   ══════════════════════════════════════════════════════════════ */

.rp-policy-output {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2.5rem 3rem;
  background: #fff;
  line-height: 1.7;
  font-size: 0.93rem;
}

/* Policy header */
.rp-policy-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #222;
}
.rp-policy-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}
.rp-policy-meta {
  font-size: 0.85rem;
  opacity: 0.7;
  line-height: 1.6;
}
.rp-policy-meta p {
  margin: 0;
}
.rp-policy-intro {
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

/* Policy sections */
.rp-policy-section {
  margin-bottom: 2rem;
}
.rp-policy-section + .rp-policy-section {
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

/* Policy headings */
.rp-policy-h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.rp-policy-h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}
.rp-policy-h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
  opacity: 0.75;
}

/* Policy body text */
.rp-policy-section p {
  margin: 0.5rem 0;
}
.rp-policy-list {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
.rp-policy-list li {
  margin-bottom: 0.3rem;
}
.rp-policy-list--ordered {
  list-style-type: decimal;
}

/* Signature block */
.rp-policy-signature p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}
.rp-policy-rule {
  opacity: 0.2;
  letter-spacing: -0.05em;
}

/* ══════════════════════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════════════════════ */

@media print {
  /* Hide everything except the policy output */
  body * {
    visibility: hidden;
  }
  .rp-policy-output,
  .rp-policy-output * {
    visibility: visible;
  }
  .rp-policy-output {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    border: none;
    padding: 1.5cm 2cm;
    font-size: 11pt;
    line-height: 1.65;
    background: #fff;
    color: #000;
    box-shadow: none;
  }
  .rp-result-actions {
    display: none;
  }
  .rp-policy-title {
    font-size: 14pt;
  }
  .rp-policy-h2 {
    font-size: 12pt;
  }
  .rp-policy-section + .rp-policy-section {
    page-break-inside: avoid;
  }
  .rp-policy-signature {
    page-break-inside: avoid;
    margin-top: 2cm;
  }
}

/* ── Responsivitet ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .rp-policy-output {
    padding: 1.5rem 1.25rem;
  }
  .rp-step-header {
    gap: 0.6rem;
  }
  .rp-step-number {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.8rem;
  }
  .rp-fieldset--inline {
    flex-direction: column;
    gap: 0.5rem;
  }
  .rp-wysiwyg-editor {
    min-height: 160px;
  }
}

/* ── Fakta field group ──────────────────────────────────────── */
.rp-field-group--fakta {
  border-left-color: #b0c4de;
  background: #f5f8fc;
  gap: 1rem;
}
.rp-fakta-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rp-fakta-editor-wrap {
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
  margin-top: 0.25rem;
}
/* Higher specificity: hidden state must win over display:flex above */
.rp-fakta-editor-wrap.rp-conditional--hidden {
  display: none;
}

/* ── WYSIWYG toolbar ────────────────────────────────────────── */
.rp-wysiwyg-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0.35rem 0.5rem;
  background: #f0f0f0;
  border-bottom: 1px solid #ccc;
  flex-wrap: wrap;
}
.rp-wysiwyg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  font-family: inherit;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 2px;
  cursor: pointer;
  color: #333;
  transition: background 0.1s, border-color 0.1s;
  line-height: 1;
}
.rp-wysiwyg-btn:hover { background: #e8e8e8; border-color: #999; }
.rp-wysiwyg-btn--active { background: #222; color: #fff; border-color: #222; }
.rp-wysiwyg-btn--block { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; }

/* ── WYSIWYG editor area ────────────────────────────────────── */
.rp-wysiwyg-editor {
  padding: 0.85rem 1rem;
  min-height: 220px;
  font-size: 0.88rem;
  line-height: 1.65;
  outline: none;
  overflow-y: auto;
}
.rp-wysiwyg-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08);
}
.rp-wysiwyg-editor h2 { font-size: 1rem; font-weight: 700; margin: 0.75rem 0 0.35rem; }
.rp-wysiwyg-editor h3 { font-size: 0.92rem; font-weight: 700; margin: 0.65rem 0 0.25rem; }
.rp-wysiwyg-editor p  { margin: 0 0 0.5rem; }
.rp-wysiwyg-editor h2:first-child,
.rp-wysiwyg-editor h3:first-child { margin-top: 0; }
.rp-wysiwyg-editor a  { color: inherit; }

/* ── Fakta-sektioner i policy-output ────────────────────────── */
.rp-policy-fakta {
  background: #f7f9fc;
  border-left: 3px solid #b0c4de;
  padding-left: 1.25rem;
  border-radius: 0 4px 4px 0;
}
.rp-policy-fakta h2 { font-size: 1rem; font-weight: 700; margin: 0 0 0.75rem; }
.rp-policy-fakta h3 { font-size: 0.95rem; font-weight: 700; margin: 1rem 0 0.4rem; }
.rp-policy-fakta p  { margin: 0.4rem 0; }
.rp-policy-fakta a  { color: inherit; }

@media print {
  .rp-policy-fakta {
    background: none;
    border-left: 1px solid #ccc;
  }
}
