/**
 * PVV v5 — Denial Decoder widget styles.
 *
 * Design language mirrors pvv-ask (amber/sand) but shifts to a slightly
 * cooler, more "serious legal notice" palette (slate + amber accents)
 * because a denial letter is a bad-news context. Same radii, same type
 * ramp, same button sizing as the sibling Ask widget.
 */

.pvv-denial {
  margin: 40px 0;
  padding: 26px 28px;
  background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 100%);
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.pvv-denial-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: #0f172a;
  border: 0;
  padding: 0;
}
.pvv-denial-dek {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: #334155;
}
.pvv-denial-dek kbd {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #0f172a;
}

/* ── Form ──────────────────────────────────────────────────────────── */
.pvv-denial-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.pvv-denial-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.pvv-denial-input-wrap { position: relative; }
.pvv-denial-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #94a3b8;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pvv-denial-input:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

.pvv-denial-suggest {
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin: 4px 0 0; padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  z-index: 50;
  max-height: 260px; overflow-y: auto;
}
.pvv-denial-suggest[hidden] { display: none; }
.pvv-denial-suggest li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px; align-items: baseline;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.pvv-denial-suggest li:hover,
.pvv-denial-suggest li:focus {
  background: #fef3c7;
  outline: none;
}
.pvv-denial-suggest-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  color: #0f172a;
}
.pvv-denial-suggest-agency {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
}
.pvv-denial-suggest-hint { color: #475569; }

.pvv-denial-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pvv-denial-state {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: #475569;
}
.pvv-denial-state-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}
.pvv-denial-submit {
  padding: 10px 22px;
  background: #d97706;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.pvv-denial-submit:hover:not(:disabled) { background: #b45309; }
.pvv-denial-submit:disabled { opacity: 0.7; cursor: wait; }

/* ── Results ──────────────────────────────────────────────────────── */
.pvv-denial-results { margin-top: 18px; }
.pvv-denial-loading {
  padding: 14px 16px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #475569;
  font-style: italic;
}
.pvv-denial-error {
  padding: 14px 16px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #b91c1c;
}
.pvv-denial-empty {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  border-radius: 8px;
  color: #334155;
}
.pvv-denial-empty strong { display: block; margin-bottom: 6px; color: #78350f; }

/* ── Card ─────────────────────────────────────────────────────────── */
.pvv-denial-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.pvv-denial-card-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12px;
  margin-bottom: 6px;
}
.pvv-denial-agency {
  padding: 2px 8px;
  background: #1e293b;
  color: #fff;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pvv-denial-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  color: #0f172a;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.pvv-denial-confidence {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: auto;
}
.pvv-denial-conf-high   { background: #d1fae5; color: #065f46; }
.pvv-denial-conf-medium { background: #fef3c7; color: #92400e; }
.pvv-denial-conf-low    { background: #fee2e2; color: #991b1b; }
.pvv-denial-conf-none   { background: #f1f5f9; color: #475569; }

.pvv-denial-title {
  margin: 4px 0 14px;
  font-size: 18px;
  color: #0f172a;
  font-weight: 700;
  line-height: 1.3;
}

/* ── Sections ─────────────────────────────────────────────────────── */
.pvv-denial-section { margin: 16px 0; }
.pvv-denial-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  border: 0; padding: 0;
}
.pvv-denial-plain .pvv-standard,
.pvv-denial-plain .pvv-simplified {
  padding: 10px 14px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.55;
  color: #1e293b;
}
.pvv-denial-triggers { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.55; color: #334155; }
.pvv-denial-triggers li { margin-bottom: 4px; }

.pvv-denial-checklist {
  list-style: none;
  margin: 0; padding: 0;
}
.pvv-denial-checklist li {
  padding: 6px 0;
  border-bottom: 1px dashed #e2e8f0;
  font-size: 14px;
  line-height: 1.45;
}
.pvv-denial-checklist li:last-child { border-bottom: 0; }
.pvv-denial-checklist input[type="checkbox"] {
  margin-right: 8px;
  transform: translateY(1px);
}
.pvv-denial-checklist label {
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  cursor: pointer;
  color: #334155;
}

.pvv-denial-next,
.pvv-denial-escape {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 8px;
}
.pvv-denial-escape { background: #fef3c7; }

/* ── Appeal path ──────────────────────────────────────────────────── */
.pvv-denial-appeal { }
.pvv-denial-appeal-lead {
  margin: 0 0 12px;
  font-size: 13px;
  color: #334155;
}
.pvv-denial-levels {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
  counter-reset: lvl;
}
.pvv-denial-level {
  position: relative;
  padding: 12px 14px 12px 14px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #0ea5e9;
  border-radius: 8px;
}
.pvv-denial-level-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.pvv-denial-level-num {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  background: #0ea5e9;
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
}
.pvv-denial-level-name {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
  font-weight: 700;
  border: 0;
}
.pvv-denial-level-rate {
  margin-left: auto;
  font-size: 12px;
  color: #065f46;
  background: #d1fae5;
  border-radius: 4px;
  padding: 2px 8px;
  font-weight: 700;
}
.pvv-denial-level-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px 18px;
  margin: 0;
  font-size: 13px;
}
.pvv-denial-level-meta > div { display: flex; flex-direction: column; }
.pvv-denial-level-meta dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 700;
}
.pvv-denial-level-meta dd {
  margin: 0;
  color: #0f172a;
}
.pvv-denial-level-note {
  margin: 8px 0 0;
  padding: 6px 10px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
}

/* ── Citations ────────────────────────────────────────────────────── */
.pvv-denial-sources ul { margin: 0; padding-left: 20px; font-size: 13px; color: #334155; }
.pvv-denial-sources li { margin-bottom: 4px; line-height: 1.5; }
.pvv-denial-cite {
  display: inline-block;
  padding: 1px 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: #0369a1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.1s, border-color 0.1s;
}
.pvv-denial-cite:hover, .pvv-denial-cite:focus {
  background: #e0f2fe;
  border-color: #0ea5e9;
  outline: none;
}

/* ── Help block ──────────────────────────────────────────────────── */
.pvv-denial-help {
  padding: 14px 16px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
}
.pvv-denial-help h4 { color: #065f46; }
.pvv-denial-help-card {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #334155;
}
.pvv-denial-help-card p { margin: 4px 0; }
.pvv-denial-help-free {
  margin-left: 6px;
  padding: 1px 6px;
  background: #065f46;
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pvv-denial-help-fallback { background: #fff7ed; border-color: #fdba74; }
.pvv-denial-help-fallback h4 { color: #9a3412; }
.pvv-denial-help-generic { background: #f8fafc; border-color: #cbd5e1; }
.pvv-denial-help-generic h4 { color: #334155; }

/* ── Footer / verify ─────────────────────────────────────────────── */
.pvv-denial-card-footer { margin-top: 14px; border-top: 1px dashed #e2e8f0; padding-top: 12px; }
.pvv-denial-verify {
  margin: 0;
  padding: 10px 12px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 6px;
  font-size: 12px;
  color: #7f1d1d;
}
.pvv-denial-disclaimer {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed #cbd5e1;
  font-size: 11px;
  line-height: 1.55;
  color: #475569;
}

/* ── Alts (other close matches) ──────────────────────────────────── */
.pvv-denial-alts { margin-top: 14px; }
.pvv-denial-alts h4 {
  font-size: 13px; color: #64748b; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin: 0 0 6px;
}
.pvv-denial-alts ul { list-style: none; margin: 0; padding: 0; }
.pvv-denial-alts li { margin-bottom: 6px; }
.pvv-denial-alt {
  display: block; width: 100%;
  text-align: left;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  line-height: 1.45;
}
.pvv-denial-alt:hover, .pvv-denial-alt:focus {
  background: #f1f5f9;
  border-color: #94a3b8;
  outline: none;
}

/* ── History ─────────────────────────────────────────────────────── */
.pvv-denial-history {
  margin-top: 20px;
  padding: 12px 14px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}
.pvv-denial-history-title {
  margin: 0 0 8px; padding: 0; border: 0;
  font-size: 12px; color: #475569;
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
}
.pvv-denial-history-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.pvv-denial-history-list li {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px;
}
.pvv-denial-history-item {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #0f172a;
  cursor: pointer;
}
.pvv-denial-history-item:hover, .pvv-denial-history-item:focus {
  background: #e2e8f0;
  outline: none;
}
.pvv-denial-history-hint { color: #64748b; font-size: 12px; }

/* ── Plain-language toggle: relies on pvv-a11y.css  ──────────────
   When <html> carries the class pvv-simplified-content, the pvv-a11y.js
   toggle flips .pvv-standard / .pvv-simplified visibility inside any
   [data-pvv-simplified] block. We just need to make sure neither is
   display:none below it — pvv-a11y.css already handles this.           */

/* ── High contrast ───────────────────────────────────────────────── */
html.pvv-high-contrast .pvv-denial {
  background: #fff; border: 2px solid #000;
}
html.pvv-high-contrast .pvv-denial-card {
  background: #fff; border: 2px solid #000;
}
html.pvv-high-contrast .pvv-denial-cite {
  border-color: #000;
  color: #000;
  background: #ff0;
}
html.pvv-high-contrast .pvv-denial-submit {
  background: #000; color: #ff0;
}

/* ── Reduce motion ───────────────────────────────────────────────── */
html.pvv-reduced-motion .pvv-denial *,
html.pvv-reduced-motion .pvv-denial *::before,
html.pvv-reduced-motion .pvv-denial *::after {
  transition: none !important;
  animation: none !important;
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  .pvv-denial-form, .pvv-denial-suggest, .pvv-denial-history, .pvv-denial-alts { display: none !important; }
  .pvv-denial { background: #fff !important; border: 1px solid #000 !important; }
  .pvv-denial-card { box-shadow: none !important; border: 1px solid #000 !important; }
  .pvv-denial-cite { background: transparent !important; border: 0 !important; color: #000 !important; font-weight: 600; }
}

/* ── Narrow viewports ────────────────────────────────────────────── */
@media (max-width: 520px) {
  .pvv-denial { padding: 18px 16px; }
  .pvv-denial-controls { flex-direction: column; align-items: stretch; }
  .pvv-denial-submit { width: 100%; }
  .pvv-denial-suggest li { grid-template-columns: auto auto; }
  .pvv-denial-suggest-hint { grid-column: 1 / -1; }
  .pvv-denial-level-head { flex-wrap: wrap; }
  .pvv-denial-level-rate { margin-left: 0; }
}
