/**
 * ─── Descripción ──────────────────────────────────────────────────────────
 * Estilos de Debates: el diseño del equipo (.mp-debate — vista completa y
 * sus comentarios con posturas/tally/votos) + la card del shortcode
 * (.mp-debate-card). Dos prefijos propios del módulo: .mp-debate para la
 * vista y .mp-debate-card para la card — nunca se reutilizan en otro widget.
 * Los valores de color replican los tokens de DESIGN.md (viven declarados
 * en la raíz de cada componente porque el CSS se encola por shortcode).
 *
 * ─── Dependencias ─────────────────────────────────────────────────────────
 * DESIGN.md → paleta (navy, gold, alert-red/green, bg-soft, border…)
 *
 * ─── Usado por ────────────────────────────────────────────────────────────
 * class-debate-renderer.php (encolado con filemtime: card y vista)
 * assets/js/debates.js (estados .is-voted, [data-mp-*])
 * ──────────────────────────────────────────────────────────────────────────
 */

/* ============================================================
   .mp-debate — Entrada de debate (contenido centrado + comentarios)
   Prefijo de clase: .mp-debate — no reutilizar en otro widget.
   ============================================================ */
.mp-debate {
  --navy-dark: #14265e;
  --navy: #1c3a8a;
  --navy-light: #2b4fa8;
  --gold: #f5a623;
  --gold-dark: #e0951a;

  --text-dark: #16204a;
  --text-body: #3d4560;
  --text-muted: #7a8296;
  --border: #e7e9f0;
  --bg-soft: #f6f7fb;

  --blue-bg: #e8ecfc;
  --green: #1f8a4c;
  --green-bg: #e4f5ea;
  --gray-bg: #eef0f4;
  --alert-red: #c0392b;
  --alert-red-bg: #fbe7e4;
  --alert-orange: #c07a10;
  --alert-orange-bg: #fdf1de;

  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  color: var(--text-body);
  background: #fff;
  box-sizing: border-box;
}
.mp-debate *, .mp-debate *::before, .mp-debate *::after { box-sizing: inherit; }
.mp-debate a { text-decoration: none; cursor: pointer; }
.mp-debate svg { display: block; }
.mp-debate a:focus-visible, .mp-debate button:focus-visible, .mp-debate textarea:focus-visible,
.mp-debate input:focus-visible + label { outline: 2px solid var(--navy); outline-offset: 2px; }

.mp-debate__inner { max-width: 980px; margin: 0 auto; padding: 32px; }
.mp-debate__col { max-width: 720px; margin: 0 auto; }

/* --- Placeholder: sin debates activos --- */
.mp-debate-empty {
  max-width: 520px; margin: 0 auto; text-align: center; padding: 56px 0;
}
.mp-debate-empty__title {
  font-size: 24px; font-weight: 800; color: var(--text-dark); margin: 0 0 10px;
}
.mp-debate-empty__text {
  font-size: 15px; line-height: 1.6; color: var(--text-body); margin: 0 auto 24px; max-width: 440px;
}

/* --- Breadcrumb / estado --- */
.mp-debate__topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 28px;
}
.mp-debate__crumbs a { color: var(--text-muted); }
.mp-debate__crumbs a:hover { color: var(--navy); }
.mp-debate__crumbs .sep { margin: 0 6px; opacity: .6; }
.mp-debate__crumbs .current { color: var(--text-dark); font-weight: 600; }
.mp-debate__live { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-dark); }
.mp-debate__live .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }

/* --- Encabezado --- */
.mp-debate__head { text-align: center; }
.mp-debate__tags { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.mp-debate__tag {
  font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; background: var(--gray-bg); color: var(--text-body);
}
.mp-debate__tag--debate { background: var(--gold); color: var(--navy-dark); }
.mp-debate__title { font-size: 38px; line-height: 1.2; font-weight: 800; color: var(--text-dark); margin: 0 0 16px; }
.mp-debate__excerpt { font-size: 16.5px; line-height: 1.6; color: var(--text-body); margin: 0 auto 24px; max-width: 640px; }

/* --- Metadatos del debate --- */
.mp-debate__meta {
  display: flex; justify-content: center; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted); margin-bottom: 28px;
}
.mp-debate__author { display: inline-flex; align-items: center; gap: 10px; color: var(--text-dark); font-weight: 700; }
.mp-debate__avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: var(--navy-dark);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.mp-debate__stat { display: inline-flex; align-items: center; gap: 6px; }
.mp-debate__stat svg { width: 16px; height: 16px; color: var(--navy); }
.mp-debate__stat strong { color: var(--text-dark); font-weight: 800; }

/* --- Imagen destacada --- */
.mp-debate__hero-figure { margin: 0 0 36px; }
.mp-debate__hero {
  position: relative; border-radius: 14px; overflow: hidden; margin: 0 0 10px; aspect-ratio: 16 / 8;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy-light));
}
.mp-debate__hero img { width: 100%; height: 100%; object-fit: cover; }
.mp-debate__caption { font-size: 12.5px; color: var(--text-muted); font-style: italic; text-align: center; margin: 0; }

/* --- Pregunta del debate --- */
.mp-debate__question {
  background: var(--bg-soft); border: 1px solid var(--border); border-left: 4px solid var(--gold);
  border-radius: 0 12px 12px 0; padding: 18px 22px; margin: 0 0 32px;
}
.mp-debate__question-label {
  font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--gold-dark); margin: 0 0 6px;
}
.mp-debate__question-text { font-size: 19px; font-weight: 800; line-height: 1.4; color: var(--text-dark); margin: 0; }

/* --- Contenido --- */
.mp-debate__body p { font-size: 15.5px; line-height: 1.8; margin: 0 0 20px; color: var(--text-body); }
/* Dropcap: el editor clásico no etiqueta el primer párrafo, se toma el
   primer <p> directo del contenido (mismo efecto que el diseño). */
.mp-debate__body > p:first-of-type::first-letter,
.mp-debate__dropcap::first-letter {
  float: left; font-size: 66px; font-weight: 800; line-height: .85; color: var(--navy-dark); padding: 4px 10px 0 0;
}
.mp-debate__body h2 { font-size: 22px; font-weight: 800; color: var(--text-dark); margin: 36px 0 14px; line-height: 1.3; }
.mp-debate__body h3 { font-size: 17px; font-weight: 800; color: var(--text-dark); margin: 28px 0 12px; }
.mp-debate__quote { margin: 26px 0; padding: 18px 22px 18px 24px; border-left: 4px solid var(--gold); background: var(--bg-soft); border-radius: 0 10px 10px 0; }
.mp-debate__quote p { font-size: 17px; font-style: italic; color: var(--text-dark); margin: 0 0 10px; line-height: 1.55; }
.mp-debate__quote cite { font-style: normal; font-size: 11.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--text-muted); }

/* --- Llamado a participar --- */
.mp-debate__cta {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--navy-dark); color: #fff; border-radius: 14px; padding: 20px 24px; margin: 36px 0 0;
}
.mp-debate__cta p { margin: 0; font-size: 15px; line-height: 1.5; font-weight: 600; max-width: 460px; }
.mp-debate__btn {
  display: inline-block; border: none; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 800; padding: 12px 24px; background: var(--gold); color: var(--navy-dark);
  transition: background .15s; text-decoration: none;
}
.mp-debate__btn:hover { background: var(--gold-dark); }

/* ================= Comentarios ================= */
.mp-debate__comments { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.mp-debate__section-title {
  display: flex; align-items: center; gap: 14px; margin: 0 0 18px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--text-dark);
}
.mp-debate__section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.mp-debate__comments-title { font-size: 24px; font-weight: 800; color: var(--text-dark); margin: 0 0 18px; }

/* Avisos: comentarios cerrados / sin comentarios todavía */
.mp-debate__closed,
.mp-debate__sin-comentarios {
  font-size: 14px; color: var(--text-muted); background: var(--bg-soft);
  border: 1px dashed var(--border); border-radius: 10px; padding: 16px; text-align: center; margin: 0 0 8px;
}

/* Resumen de posturas */
.mp-debate__tally { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 24px; }
.mp-debate__tally-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--gray-bg); margin-bottom: 12px; }
.mp-debate__tally-bar span:nth-child(1) { background: var(--green); }
.mp-debate__tally-bar span:nth-child(2) { background: var(--alert-red); }
.mp-debate__tally-bar span:nth-child(3) { background: #b8bfd0; }
.mp-debate__tally-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--text-body); }
.mp-debate__tally-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mp-debate__tally-legend i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.mp-debate__tally-legend b { color: var(--text-dark); font-weight: 800; }

/* Formulario */
.mp-debate__form { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 20px; margin-bottom: 28px; }
.mp-debate__form-row { display: flex; gap: 14px; }
.mp-debate__form-main { flex: 1; min-width: 0; }
.mp-debate__textarea {
  width: 100%; min-height: 110px; resize: vertical; font-family: inherit; font-size: 14.5px; line-height: 1.6;
  color: var(--text-dark); border: 1px solid #c9cee0; border-radius: 8px; padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.mp-debate__textarea::placeholder { color: var(--text-muted); }
.mp-debate__textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.mp-debate__form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-top: 12px; }
.mp-debate__stance { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: none; margin: 0; padding: 0; }
.mp-debate__stance legend { float: left; font-size: 12.5px; font-weight: 700; color: var(--text-muted); padding: 0; margin-right: 10px; line-height: 32px; }
.mp-debate__stance input { position: absolute; opacity: 0; pointer-events: none; }
.mp-debate__stance label {
  display: inline-block; font-size: 12.5px; font-weight: 700; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); color: var(--text-body); background: #fff; transition: background .15s, color .15s, border-color .15s;
}
.mp-debate__stance label:hover { background: var(--bg-soft); }
.mp-debate__stance input:checked + .st-favor  { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.mp-debate__stance input:checked + .st-contra { background: var(--alert-red-bg); border-color: var(--alert-red); color: var(--alert-red); }
.mp-debate__stance input:checked + .st-matiz  { background: var(--gray-bg); border-color: #8a91a6; color: var(--text-dark); }
.mp-debate__rules { font-size: 12px; color: var(--text-muted); margin: 12px 0 0; line-height: 1.5; }

/* Mensajes de publicación AJAX (ok / error / aviso de moderación) */
.mp-debate__form-msg {
  font-size: 13px; font-weight: 700; line-height: 1.5;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; margin: 12px 0 0;
}
.mp-debate__form-msg.is-ok    { color: var(--green); border-color: var(--green); background: var(--green-bg); }
.mp-debate__form-msg.is-error { color: var(--alert-red); border-color: var(--alert-red); background: var(--alert-red-bg); }
.mp-debate__form-msg.is-warn  { color: var(--alert-orange); border-color: var(--alert-orange); background: var(--alert-orange-bg); }

/* Aviso "respondiendo a…" (respuesta nativa con parent oculto) */
.mp-debate__replying { font-size: 12.5px; color: var(--text-muted); margin: 12px 0 0; }
.mp-debate__replying strong { color: var(--text-dark); }
.mp-debate__reply-cancel {
  background: none; border: none; padding: 0; font-family: inherit; font-size: inherit; font-weight: 700;
  color: var(--navy); cursor: pointer; text-decoration: underline;
}
.mp-debate__reply-cancel:hover { color: var(--gold-dark); }

/* Gate de login: sin sesión no hay formulario */
.mp-debate__gate {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px 24px; text-align: center; margin-bottom: 28px;
}
.mp-debate__gate-title { font-size: 18px; font-weight: 800; color: var(--text-dark); margin: 0 0 8px; }
.mp-debate__gate-text {
  font-size: 14.5px; line-height: 1.6; color: var(--text-body); margin: 0 auto 20px; max-width: 460px;
}
.mp-debate__gate-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mp-debate__gate-register { font-size: 13px; font-weight: 700; color: var(--navy); }
.mp-debate__gate-register:hover { color: var(--gold-dark); }

/* Orden */
.mp-debate__sort { display: flex; gap: 6px; margin-bottom: 8px; }
.mp-debate__sort a { font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px; color: var(--text-body); }
.mp-debate__sort a:hover { background: var(--bg-soft); }
.mp-debate__sort a.is-active { background: var(--blue-bg); color: var(--navy-dark); }

/* Lista de comentarios */
.mp-debate__list { list-style: none; margin: 0; padding: 0; }
.mp-debate__comment { display: flex; gap: 14px; padding: 22px 0; border-top: 1px solid var(--border); }
.mp-debate__comment:first-child { border-top: none; }
.mp-debate__c-body { flex: 1; min-width: 0; }
.mp-debate__c-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin-bottom: 6px; }
.mp-debate__c-name { font-size: 14.5px; font-weight: 800; color: var(--text-dark); }
.mp-debate__c-time { font-size: 12px; color: var(--text-muted); }
.mp-debate__badge { font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.mp-debate__badge--favor  { background: var(--green-bg); color: var(--green); }
.mp-debate__badge--contra { background: var(--alert-red-bg); color: var(--alert-red); }
.mp-debate__badge--matiz  { background: var(--gray-bg); color: var(--text-body); }
.mp-debate__badge--autor  { background: var(--gold); color: var(--navy-dark); }
.mp-debate__c-text { font-size: 14.5px; line-height: 1.7; color: var(--text-body); margin: 0 0 10px; }
.mp-debate__c-actions { display: flex; align-items: center; gap: 18px; }
.mp-debate__c-actions a, .mp-debate__c-actions button {
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--text-muted); background: none; border: none; padding: 0; cursor: pointer;
}
.mp-debate__c-actions svg { width: 16px; height: 16px; }
.mp-debate__c-actions a:hover, .mp-debate__c-actions button:hover { color: var(--navy); }

/* Estado ya votado */
.mp-debate__c-vote.is-voted {
  color: var(--navy-dark); background: var(--blue-bg); border-radius: 999px; padding: 4px 10px;
}
.mp-debate__c-vote.is-voted:hover { color: var(--navy-dark); }
.mp-debate__c-vote:disabled { cursor: default; }

/* Voto reactivo: el contador crece al instante (feedback optimista) */
.mp-debate__c-vote { transition: color .15s, background-color .15s, transform .1s; }
.mp-debate__c-vote:active { transform: scale(.94); }
.mp-debate__c-vote .mp-debate__c-votos { display: inline-block; }
.mp-debate__c-vote .mp-debate__c-votos.is-pop { animation: mp-debate-pop .28s ease; }
@keyframes mp-debate-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* Lista cargando (orden / "Ver más"): patrón aria-busy del proyecto */
.mp-debate__comments [data-mp-lista] { transition: opacity .15s ease; }
.mp-debate__comments [data-mp-lista][aria-busy="true"] {
  opacity: .5; pointer-events: none;
}

.mp-debate__replies { list-style: none; margin: 14px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.mp-debate__replies .mp-debate__comment { padding: 14px 0 0; border-top: none; }
.mp-debate__replies .mp-debate__avatar { width: 30px; height: 30px; font-size: 11px; }

.mp-debate__more { text-align: center; margin-top: 12px; }
.mp-debate__btn-outline {
  display: inline-block; border: 1px solid var(--navy); color: var(--navy); background: transparent; border-radius: 8px;
  font-family: inherit; font-size: 13.5px; font-weight: 800; padding: 11px 26px; cursor: pointer;
  transition: background .15s, color .15s; text-decoration: none;
}
.mp-debate__btn-outline:hover { background: var(--navy); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .mp-debate__btn, .mp-debate__btn-outline, .mp-debate__textarea, .mp-debate__stance label { transition: none; }
  .mp-debate__c-vote, .mp-debate__comments [data-mp-lista] { transition: none; }
  .mp-debate__c-vote .mp-debate__c-votos.is-pop { animation: none; }
  .mp-debate__c-vote:active { transform: none; }
}

/* --- Responsive (vista) --- */
@media (max-width: 980px) { .mp-debate__title { font-size: 32px; } }
@media (max-width: 720px) {
  .mp-debate__title { font-size: 28px; }
  .mp-debate__question-text { font-size: 17px; }
}
@media (max-width: 640px) {
  .mp-debate__inner { padding: 18px; }
  .mp-debate__form { padding: 16px; }
  .mp-debate__form-row > .mp-debate__avatar { display: none; }
  .mp-debate__form-foot { flex-direction: column; align-items: stretch; }
  .mp-debate__form-foot .mp-debate__btn { width: 100%; text-align: center; }
  .mp-debate__cta { padding: 18px; }
  .mp-debate__cta .mp-debate__btn { width: 100%; text-align: center; }
  .mp-debate__comment { gap: 10px; }
  .mp-debate__replies { padding-left: 12px; }
}

/* ============================================================
   .mp-debate-card — Card del shortcode [mp_debate_card]
   Prefijo propio: .mp-debate-card — no reutilizar en otro widget.
   ============================================================ */
.mp-debate-card {
  --navy-dark: #14265e;
  --navy: #1c3a8a;
  --gold: #f5a623;
  --gold-dark: #e0951a;

  --text-dark: #16204a;
  --text-body: #3d4560;
  --text-muted: #7a8296;
  --border: #e7e9f0;
  --bg-soft: #f6f7fb;

  --green: #1f8a4c;
  --green-bg: #e4f5ea;
  --gray-bg: #eef0f4;

  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}
.mp-debate-card *, .mp-debate-card *::before, .mp-debate-card *::after { box-sizing: inherit; }
.mp-debate-card a { text-decoration: none; cursor: pointer; }
.mp-debate-card svg { display: block; color: var(--navy); }
.mp-debate-card a:focus-visible, .mp-debate-card .mp-debate-card__btn:focus-visible {
  outline: 2px solid var(--navy); outline-offset: 2px;
}

.mp-debate-card__top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}

/* Imagen destacada (media 16/10 o placeholder gradiente navy) */
.mp-debate-card__media {
  display: block; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden;
  margin: 0 0 16px;
  background: linear-gradient(135deg, var(--navy-dark), var(--navy-light));
}
.mp-debate-card__media img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.mp-debate-card__tags { display: flex; gap: 8px; flex-wrap: wrap; }
.mp-debate-card__tag {
  font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; background: var(--gray-bg); color: var(--text-body);
}
.mp-debate-card__tag--debate { background: var(--gold); color: var(--navy-dark); }
.mp-debate-card__estado {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text-dark);
}
.mp-debate-card__dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--green); box-shadow: 0 0 0 3px var(--green-bg);
}

.mp-debate-card__titulo {
  font-size: 24px; line-height: 1.25; font-weight: 800; color: var(--text-dark); margin: 0 0 10px;
}
.mp-debate-card__titulo a { color: inherit; }
.mp-debate-card__titulo a:hover { color: var(--navy); }

.mp-debate-card__excerpt {
  font-size: 15px; line-height: 1.6; color: var(--text-body); margin: 0 0 16px;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

.mp-debate-card__meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 20px;
}
.mp-debate-card__stat { display: inline-flex; align-items: center; gap: 6px; }
.mp-debate-card__stat svg { width: 15px; height: 15px; }
.mp-debate-card__stat strong { color: var(--text-dark); font-weight: 800; }

.mp-debate-card__btn {
  align-self: flex-start; margin-top: auto;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gold); color: var(--navy-dark);
  font-size: 14px; font-weight: 800; padding: 12px 24px; border-radius: 8px;
  transition: background .15s;
}
.mp-debate-card__btn:hover { background: var(--gold-dark); }

@media (max-width: 640px) {
  .mp-debate-card { padding: 18px; }
  .mp-debate-card__titulo { font-size: 20px; }
  .mp-debate-card__btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .mp-debate-card__btn { transition: none; }
}
