/* ===========================================================================
   Frontend del auditor de Consent Mode — guía de estilo basada en audidat.com
   =========================================================================== */

:root {
  --blue:        #003D82;
  --blue-dark:   #002451;
  --blue-pale:   #E8F1F8;
  --text:        #2C2C2C;
  --muted:       #5E6A75;
  --line:        #DDE5EC;
  --bg:          #F5F7FA;
  --white:       #FFFFFF;
  --green:       #00A651;
  --green-pale:  #E4F5EC;
  --amber:       #E8A200;
  --amber-pale:  #FBF3DC;
  --red:         #D32F2F;
  --red-pale:    #FBE9E9;
  --crit:        #B71C1C;
  --gray:        #8A94A0;
  --gray-pale:   #EEF1F4;
  --orange:      #FF6B35;
  --orange-dark: #E5571F;
  --radius:      8px;
  --shadow:      0 2px 8px rgba(0, 0, 0, .08);
  --shadow-up:   0 8px 24px rgba(0, 61, 130, .12);
  --font-head:   'Montserrat', 'Trebuchet MS', sans-serif;
  --font-body:   'Open Sans', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

main { flex: 1; }

.container { max-width: 980px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 640px; }

h1, h2, h3 { font-family: var(--font-head); color: var(--blue); }

a { color: var(--blue); }

button { font-family: inherit; }

[hidden] { display: none !important; }

/* --- Cabecera ------------------------------------------------------------ */

.topbar {
  background: var(--white);
  border-top: 4px solid var(--orange);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand { display: flex; align-items: center; }

.logo { height: 38px; width: auto; display: block; }

.topbar-tag {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

/* --- Hero / formulario ---------------------------------------------------- */

.hero {
  background:
    radial-gradient(640px 320px at 12% -10%, rgba(0, 61, 130, .10), transparent 70%),
    radial-gradient(560px 300px at 95% 0%, rgba(255, 107, 53, .10), transparent 70%),
    linear-gradient(180deg, var(--blue-pale) 0%, var(--bg) 100%);
}

.hero-inner { padding: 72px 24px 64px; text-align: center; }

.hero-kicker {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--orange-dark);
  background: var(--white);
  border: 1px solid rgba(255, 107, 53, .35);
  border-radius: 999px;
  padding: 6px 16px;
  margin: 0 0 22px;
  animation: fadeUp .5s ease both;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 18px;
  animation: fadeUp .5s ease .08s both;
}

.hero-sub {
  max-width: 620px;
  margin: 0 auto 34px;
  color: var(--muted);
  font-size: 17px;
  animation: fadeUp .5s ease .16s both;
}

.audit-form {
  display: flex;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-up);
  animation: fadeUp .5s ease .24s both;
}

.audit-form input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  padding: 10px 12px;
  background: transparent;
}

.audit-form input::placeholder { color: #9AA6B2; }

.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  border-radius: 4px;
  padding: 12px 24px;
  transition: all .3s ease;
}

.btn-cta {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(255, 107, 53, .35);
  white-space: nowrap;
}

.btn-cta:hover { background: var(--orange-dark); box-shadow: 0 6px 16px rgba(255, 107, 53, .45); }

.btn-primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0, 61, 130, .15);
}

.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 6px 16px rgba(0, 61, 130, .25); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue);
  padding: 10px 22px;
}

.btn-outline:hover { background: var(--blue-pale); }

.form-options {
  display: flex;
  gap: 22px;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
  animation: fadeUp .5s ease .28s both;
}

.form-options label { display: flex; align-items: center; gap: 7px; cursor: pointer; }

.form-options input[type="checkbox"] { accent-color: var(--blue); width: 16px; height: 16px; }

.form-options select {
  font: inherit;
  color: var(--text);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
}

.form-error {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--red);
  font-weight: 600;
}

.hero-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 860px;
  margin: 52px auto 0;
  text-align: left;
  animation: fadeUp .5s ease .32s both;
}

.point {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow .3s ease, transform .3s ease;
}

.point:hover { box-shadow: var(--shadow-up); transform: translateY(-2px); }

.point-icon {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-pale);
  color: var(--blue);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 17px;
}

.point strong { font-family: var(--font-head); font-size: 14px; color: var(--blue); display: block; }
.point span:not(.point-icon) { font-size: 13px; color: var(--muted); }

/* --- Tarjetas genéricas ---------------------------------------------------- */

.view { padding: 40px 0 64px; }
#view-form { padding: 0 0 24px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* --- Progreso -------------------------------------------------------------- */

.progress-card { text-align: center; padding: 48px 32px; }

.spinner {
  width: 52px;
  height: 52px;
  margin: 0 auto 24px;
  border-radius: 50%;
  border: 5px solid var(--blue-pale);
  border-top-color: var(--blue);
  animation: spin .9s linear infinite;
}

.progress-status { font-family: var(--font-head); font-weight: 700; font-size: 20px; color: var(--blue); margin: 0 0 6px; }
.progress-url { color: var(--muted); margin: 0 0 18px; word-break: break-all; }
.progress-hint { font-size: 13px; color: var(--gray); margin: 0; }

/* --- Error ------------------------------------------------------------------ */

.error-card { text-align: center; padding: 48px 32px; }

.error-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red-pale);
  color: var(--red);
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 26px;
}

.error-msg { font-size: 17px; margin: 0 0 24px; }

/* --- Informe ----------------------------------------------------------------- */

.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.report-head { margin-bottom: 20px; }
.report-head h2 { margin: 0 0 4px; font-size: 26px; }
.report-meta { color: var(--muted); font-size: 14px; margin: 0; word-break: break-all; }
.report-meta a { font-weight: 600; }
.report-expiry { font-size: 13px; }

.report-section { margin-bottom: 20px; }

.section-title {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

/* Veredictos */
.verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.verdict-card { position: relative; overflow: hidden; }
.verdict-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--vcolor, var(--gray));
}

.verdict-label { font-family: var(--font-head); font-weight: 700; font-size: 15px; color: var(--blue); margin: 0 0 2px; }
.verdict-question { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

.badge {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--white);
  border-radius: 4px;
  padding: 6px 14px;
}

.badge-sm { font-size: 11px; padding: 2px 9px; letter-spacing: .03em; }

.b-green { background: var(--green); }
.b-amber { background: var(--amber); }
.b-red   { background: var(--red); }
.b-crit  { background: var(--crit); }
.b-gray  { background: var(--gray); }

.riskbar {
  height: 10px;
  border-radius: 999px;
  background: var(--gray-pale);
  margin: 16px 0 6px;
  overflow: hidden;
}

.riskbar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--vcolor, var(--gray));
  transition: width .8s ease;
}

.risk-label { font-size: 13px; color: var(--muted); margin: 0; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 14px;
  border: 1px solid transparent;
}

.chip-on    { background: var(--blue); color: var(--white); }
.chip-off   { background: var(--gray-pale); color: var(--gray); text-decoration: line-through; }
.chip-green { background: var(--green-pale); color: #00733A; border-color: rgba(0, 166, 81, .3); }
.chip-red   { background: var(--red-pale); color: var(--crit); border-color: rgba(211, 47, 47, .3); }

/* Listas de comprobación */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }

.tick { font-weight: 700; flex: none; width: 18px; text-align: center; }
.tick-ok   { color: var(--green); }
.tick-bad  { color: var(--red); }
.tick-unk  { color: var(--gray); }

/* Tablas */
.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  padding: 8px 12px;
}

table.data td {
  border-bottom: 1px solid var(--line);
  padding: 7px 12px;
  word-break: break-all;
}

table.data tr:last-child td { border-bottom: none; }

.v-granted { color: var(--green); font-weight: 700; }
.v-denied  { color: var(--red);  font-weight: 700; }
.v-other   { color: var(--gray); }

.cat-esencial    { color: var(--green); font-weight: 600; }
.cat-no_esencial { color: var(--red);  font-weight: 700; }
.cat-desconocida { color: var(--gray); }

/* Hallazgos y cambios */
.findings { margin: 0; padding-left: 22px; }
.findings li { margin: 6px 0; }

.tag-cumplimiento {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--white);
  background: var(--blue);
  border-radius: 3px;
  padding: 1px 7px;
  margin-right: 6px;
  vertical-align: 1px;
}

/* Avisos */
.notice {
  display: flex;
  gap: 10px;
  background: var(--amber-pale);
  border: 1px solid rgba(232, 162, 0, .4);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
}

.notice-info { background: var(--blue-pale); border-color: rgba(0, 61, 130, .25); }

/* Evidencia colapsable */
details.evidence {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

details.evidence summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--blue);
}

details.evidence summary::before {
  content: "▸";
  flex: none;
  transition: transform .2s ease;
  color: var(--gray);
}

details.evidence[open] summary::before { transform: rotate(90deg); }

details.evidence summary::-webkit-details-marker { display: none; }

.summary-note { font-size: 13px; font-weight: 400; color: var(--muted); }

details.evidence .table-wrap, details.evidence .detail-body { padding: 0 18px 16px; }
.detail-body { font-size: 14px; color: var(--muted); }

.empty-note { color: var(--gray); font-size: 14px; margin: 0; }

/* Modo sitio */
.site-note {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
  font-style: italic;
}

details.page-detail .page-detail-body { padding: 4px 18px 18px; }
details.page-detail summary { word-break: break-all; }

/* --- Pie --------------------------------------------------------------------- */

.footer {
  background: var(--blue-dark);
  color: rgba(255, 255, 255, .85);
  padding: 26px 0;
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
}

.footer p { margin: 2px 0; }
.footer strong { color: var(--white); }
.footer-small { font-size: 12px; color: rgba(255, 255, 255, .55); }

.footer a {
  color: rgba(255, 255, 255, .75);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover { color: var(--white); }

/* --- Animaciones ---------------------------------------------------------------- */

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.report-enter { animation: fadeUp .45s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Responsive -------------------------------------------------------------------- */

@media (max-width: 720px) {
  .topbar-tag { display: none; }
  .hero-inner { padding: 48px 16px 40px; }
  .audit-form { flex-direction: column; }
  .btn-cta { width: 100%; }
  .hero-points { grid-template-columns: 1fr; }
  .verdicts { grid-template-columns: 1fr; }
  .report-actions { justify-content: stretch; }
  .report-actions .btn { flex: 1; }
}

/* --- Impresión / PDF ------------------------------------------------------------------ */

@media print {
  body { background: var(--white); }
  .no-print { display: none !important; }
  .view { padding: 0; }
  .card, details.evidence { box-shadow: none; break-inside: avoid; }
  .badge, .chip, .verdict-card::before, .riskbar-fill, .tag-cumplimiento {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  details.evidence summary::before { content: ""; }
  a { text-decoration: none; color: var(--text); }
  .report-head a { color: var(--blue); }
}
