/**
 * Refund Policy Generator — tool styles
 *
 * Layout, the document preview and the raw export panes. Cards, fields,
 * fieldsets, tabs, steps and stats are frikwork's — nothing here restyles a
 * frikwork component.
 *
 * One naming exception, deliberate: the generated document carries the classes
 * .policy-header / .policy-meta / .policy-section. They are not refund-*
 * prefixed because they are part of the exported markup — the "Copy HTML"
 * output rewrites them into inline styles by name, so renaming them here would
 * break the export. Every rule that touches them is scoped under .refund-doc,
 * so they still cannot reach anything outside this tool.
 */

.refund-progress { margin-bottom: var(--fw-space-lg); }

.refund-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: var(--fw-space-lg);
  align-items: start;
}

.refund-side,
.refund-main {
  display: flex;
  flex-direction: column;
  gap: var(--fw-space-lg);
}

/* The column gap already spaces the panels; app.css's sibling margin would
   double it. */
.refund-side > .app-panel + .app-panel,
.refund-main > .app-panel + .app-panel { margin-top: 0; }

/* A valid required field. frikwork ships .is-invalid but no positive state, and
   confirming "this one is fine" is half the point of validating on generate. */
.refund-valid { border-color: var(--fw-success); }

/* --- The document preview -------------------------------------------------- */

.refund-preview {
  margin-top: var(--fw-space-md);
  padding: var(--fw-space-xl);
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: var(--fw-bg-2);
  /* Standard properties rather than ::-webkit-scrollbar, so the thumb picks up
     the brand colour without a vendor-only rule and without a literal hex. */
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--fw-brand) 45%, transparent) transparent;
}

.refund-preview--populated { background: var(--fw-bg-card); }

/* fw-prose caps itself at 68ch for readability; centring keeps the document
   from hugging the left edge of a wide panel. */
.refund-doc { margin-inline: auto; }

.refund-doc .policy-header {
  text-align: center;
  margin-bottom: var(--fw-space-xl);
  padding-bottom: var(--fw-space-lg);
  border-bottom: 2px solid color-mix(in srgb, var(--fw-brand) 30%, transparent);
}

.refund-doc .policy-header h1 {
  color: var(--fw-brand-text);
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 var(--fw-space-xs);
}

.refund-doc .policy-meta {
  color: var(--fw-text-muted);
  font-size: 0.9rem;
}

.refund-doc .policy-section:last-child { margin-bottom: 0; }

.refund-doc h2 {
  color: var(--fw-brand-text);
  font-size: 1.5rem;
  border-bottom-color: color-mix(in srgb, var(--fw-brand) 30%, transparent);
  border-bottom-width: 2px;
}

.refund-doc h3 { font-size: 1.2rem; }
.refund-doc strong { color: var(--fw-brand-text); }

/* --- Plain text / HTML panes ----------------------------------------------- */

.refund-raw {
  margin-top: var(--fw-space-md);
  padding: var(--fw-space-lg);
  min-height: 400px;
  max-height: 600px;
  overflow: auto;
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: var(--fw-bg-2);
  color: var(--fw-text-2);
  font-family: var(--fw-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--fw-brand) 45%, transparent) transparent;
}

.refund-stats { margin-top: var(--fw-space-lg); }
.refund-stats .app-stat { padding: var(--fw-space-md); }
.refund-stats .app-stat__value { font-size: 1.35rem; }

/* The four export buttons wrap rather than squeeze on a narrow panel head. */
.refund-output-panel .app-panel__actions { gap: var(--fw-space-xs); }

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

@media (max-width: 768px) {
  .refund-preview { padding: var(--fw-space-lg); font-size: 0.9rem; }
  .refund-doc .policy-header h1 { font-size: 1.5rem; }
  .refund-doc h2 { font-size: 1.3rem; }
  .refund-doc h3 { font-size: 1.1rem; }
}

/* Ctrl-P on the preview should give the whole document, not the 600px window
   of it that happens to be scrolled into view. */
@media print {
  .refund-preview {
    max-height: none;
    overflow: visible;
    border: none;
    padding: 0;
  }
}
