/* ==========================================================================
   Portal de denuncias (/denuncias)
   Usa la paleta de las fichas de trámites (procedures.css: --guide-*).
   ========================================================================== */

.complaint-page { --complaint-error: #b3261e; --complaint-focus: #168983; }

/* Encabezado ------------------------------------------------------------- */
.complaint-hero { padding-bottom: 3.2rem; }
.complaint-hero h1 { margin-top: .35rem; }
.complaint-hero--compact { padding-bottom: 1.6rem; }
.complaint-hero--compact .commune-breadcrumb { margin-bottom: 0; }
.complaint-hero__facts { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.complaint-hero__facts li { display: flex; align-items: center; gap: .5rem; padding: .5rem .85rem; border: 1px solid #ffffff1f; border-radius: 999px; background: #ffffff0a; color: #dbe7f1; font-size: .8rem; }
.complaint-hero__facts i { color: #9de1cb; }

/* Formulario ------------------------------------------------------------- */
.complaint-layout { grid-template-columns: minmax(0, 1fr) 330px; }
.complaint-form { min-width: 0; }
.complaint-step { margin: 0 0 1.1rem; padding: 1.5rem 1.6rem 1.6rem; border: 1px solid var(--guide-line); border-radius: 12px; background: #fff; box-shadow: 0 5px 18px #08214205; scroll-margin-top: calc(var(--commune-sticky-top) + 1.5rem); }
.complaint-step__title { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; float: none; width: 100%; margin: 0 0 1.1rem; padding: 0; font: 500 clamp(1.1rem, 1.6vw, 1.3rem)/1.35 var(--pm-font-header); color: var(--guide-ink); }
.complaint-step__number { display: grid; flex: 0 0 34px; place-items: center; height: 34px; border-radius: 8px; background: var(--guide-teal); color: #fff; font-size: 1rem; }
.complaint-optional { display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: #edf4f0; color: var(--guide-teal); font: 500 .68rem/1.6 var(--pm-font); letter-spacing: .02em; vertical-align: middle; }
.complaint-hint { margin: -.4rem 0 1rem; color: var(--guide-muted); font-size: .8rem; line-height: 1.7; }
.complaint-hint--note { display: flex; gap: .55rem; margin: 1rem 0 0; padding: .8rem 1rem; border-radius: 8px; background: #f3f7f3; font-size: .74rem; }
.complaint-hint--note i { color: var(--guide-teal); }

.complaint-field { margin-top: 1.2rem; }
.complaint-field label { display: block; margin-bottom: .45rem; color: var(--guide-ink); font-size: .86rem; font-weight: 600; }
.complaint-field .complaint-hint { margin: -.15rem 0 .6rem; }
.complaint-field input, .complaint-field textarea { display: block; width: 100%; min-height: 48px; padding: .7rem .85rem; border: 1px solid #bccbd0; border-radius: 7px; background: #fbfdfc; color: var(--guide-ink); font: inherit; font-size: .9rem; line-height: 1.6; transition: border-color .15s, box-shadow .15s; }
.complaint-field textarea { min-height: 150px; resize: vertical; }
.complaint-field input::placeholder { color: #8a9aa6; }
.complaint-field :is(input, textarea):focus { outline: none; border-color: var(--complaint-focus); box-shadow: 0 0 0 3px #16898333; background: #fff; }
.complaint-field [aria-invalid="true"] { border-color: var(--complaint-error); background: #fff8f7; }
.complaint-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.complaint-counter { margin: .4rem 0 0; color: var(--guide-muted); font-size: .72rem; text-align: right; }
.complaint-counter.is-short { color: #8a5a00; }
.complaint-error { display: flex; gap: .4rem; margin: .5rem 0 0; color: var(--complaint-error); font-size: .78rem; font-weight: 500; line-height: 1.5; }
.complaint-error::before { content: "\F333"; font-family: "bootstrap-icons"; font-weight: 400; }
.complaint-error[hidden] { display: none; }

/* Opciones en tarjeta (identidad y motivo) */
.complaint-choices { display: grid; gap: .7rem; }
.complaint-choices--identity { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.complaint-choices--reasons { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.complaint-choice, .complaint-reason { position: relative; display: flex; gap: .85rem; align-items: start; margin: 0; padding: 1rem 1.05rem; border: 1.5px solid #d6e1df; border-radius: 10px; background: #fbfdfc; color: var(--guide-ink); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.complaint-choice:hover, .complaint-reason:hover { border-color: #9cc3b9; background: #f4f9f6; }
.complaint-choice input, .complaint-reason input { position: absolute; opacity: 0; pointer-events: none; }
.complaint-choice:has(input:checked), .complaint-reason:has(input:checked) { border-color: var(--guide-teal); background: #eaf5f0; box-shadow: inset 0 0 0 1px var(--guide-teal); }
.complaint-choice:has(input:focus-visible), .complaint-reason:has(input:focus-visible) { outline: 3px solid var(--complaint-focus); outline-offset: 3px; }
.complaint-choice__icon { display: grid; flex: 0 0 42px; place-items: center; height: 42px; border-radius: 10px; background: #e6f1ed; color: var(--guide-teal); font-size: 1.3rem; }
.complaint-choice:has(input:checked) .complaint-choice__icon { background: var(--guide-teal); color: #fff; }
.complaint-choice__text strong { display: block; font: 500 1rem/1.4 var(--pm-font-header); }
.complaint-choice__text small { display: block; margin-top: .25rem; color: var(--guide-muted); font-size: .76rem; line-height: 1.55; }
.complaint-choice::after, .complaint-reason::after { content: "\F26A"; position: absolute; top: .55rem; right: .65rem; font-family: "bootstrap-icons"; color: var(--guide-teal); font-size: 1rem; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.complaint-choice:has(input:checked)::after, .complaint-reason:has(input:checked)::after { opacity: 1; transform: none; }
.complaint-reason { align-items: center; gap: .7rem; padding: .8rem 1.8rem .8rem .85rem; font-size: .8rem; line-height: 1.4; }
.complaint-reason > i { flex: 0 0 auto; color: var(--guide-teal); font-size: 1.2rem; }
.complaint-group { display: flex; align-items: center; gap: .6rem; margin: 1.2rem 0 .6rem; color: var(--guide-teal); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.complaint-group::after { content: ""; flex: 1; height: 1px; background: var(--guide-line); }
.complaint-hint + .complaint-group { margin-top: .2rem; }

.complaint-identity { margin-top: .2rem; }
.js .complaint-identity__nojs { display: none; }
.complaint-identity__nojs { margin: 1.2rem 0 -.4rem; }
.complaint-identity[hidden] { display: none; }

/* Mapa */
.complaint-map[hidden], [data-map-fallback][hidden] { display: none; }
.complaint-map__toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.complaint-map__button { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: .55rem 1rem; border: 1px solid var(--guide-teal); border-radius: 7px; background: var(--guide-teal); color: #fff; font-size: .82rem; font-weight: 500; transition: background .15s; }
.complaint-map__button:hover { background: #0e5652; }
.complaint-map__button:disabled { opacity: .65; cursor: progress; }
.complaint-map__button--ghost { background: transparent; color: var(--guide-teal); }
.complaint-map__button--ghost:hover { background: #edf4f0; }
.complaint-map__button[hidden] { display: none; }
.complaint-map__canvas { height: 380px; border: 1px solid #cad8d5; border-radius: 10px; background: #e7eee8; overflow: hidden; z-index: 0; }
.complaint-map__canvas:focus-visible { outline: 3px solid var(--complaint-focus); outline-offset: 3px; }
.complaint-map__status { display: flex; align-items: center; gap: .45rem; margin: .6rem 0 0; color: var(--guide-muted); font-size: .78rem; }
.complaint-map__status.is-set { color: #155a4e; font-weight: 500; }
.complaint-map__status.is-set::before { content: "\F3E7"; font-family: "bootstrap-icons"; font-weight: 400; color: var(--guide-teal); }
.complaint-map__status.is-warning { color: #8a5a00; }
.complaint-pin { display: block; color: #c0392b; font-size: 38px; line-height: 1; text-shadow: 0 2px 4px #0005; }
.complaint-pin i { display: block; }
.complaint-map .leaflet-container { font-family: var(--pm-font); }
.complaint-map .leaflet-control-attribution { font-size: .65rem; }

/* Archivos */
.complaint-drop { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.6rem 1rem; border: 2px dashed #b3cbc5; border-radius: 12px; background: #f6faf8; color: var(--guide-ink); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.complaint-drop:hover, .complaint-drop.is-dragging { border-color: var(--guide-teal); background: #eaf5f0; }
.complaint-drop > i { color: var(--guide-teal); font-size: 2rem; line-height: 1; }
.complaint-drop strong { font: 500 1rem/1.4 var(--pm-font-header); }
.complaint-drop span { color: var(--guide-muted); font-size: .74rem; line-height: 1.6; }
.complaint-drop.is-full { opacity: .55; pointer-events: none; }
/* Sin JavaScript se ve el selector del navegador; con él, la zona de arriba lo reemplaza */
.complaint-drop__input { display: block; width: 100%; margin-top: .7rem; font-size: .8rem; color: var(--guide-muted); }
.js .complaint-drop__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; overflow: hidden; }
.js .complaint-drop__input:focus-visible + .complaint-files, .complaint-drop:has(+ .complaint-drop__input:focus-visible) { outline: 3px solid var(--complaint-focus); outline-offset: 3px; }
.complaint-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .65rem; margin: .8rem 0 0; padding: 0; list-style: none; }
.complaint-files:empty { display: none; }
.complaint-file { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--guide-line); border-radius: 9px; background: #fff; }
.complaint-file__preview { display: grid; place-items: center; aspect-ratio: 4 / 3; background: #eef3f1; color: #b3261e; font-size: 2.2rem; }
.complaint-file__preview img { width: 100%; height: 100%; object-fit: cover; }
.complaint-file__name { padding: .5rem .6rem 0; color: var(--guide-ink); font-size: .72rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.complaint-file__size { padding: 0 .6rem .55rem; color: var(--guide-muted); font-size: .66rem; }
.complaint-file__remove { position: absolute; top: .35rem; right: .35rem; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #082142cc; color: #fff; font-size: .8rem; }
.complaint-file__remove:hover { background: #b3261e; }
.complaint-file.is-processing .complaint-file__preview::after { content: "Preparando…"; position: absolute; inset: 0 0 auto; display: grid; place-items: center; aspect-ratio: 4 / 3; background: #ffffffb3; color: var(--guide-teal); font-size: .72rem; font-weight: 600; }

/* Campo trampa para robots: fuera de la vista, pero no display:none (algunos robots lo saltan) */
.complaint-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Avisos */
.complaint-alert { display: flex; gap: .8rem; align-items: start; margin-bottom: 1.1rem; padding: 1rem 1.2rem; border: 1px solid #b9d6cd; border-radius: 10px; background: #eef7f2; color: #155a4e; font-size: .84rem; line-height: 1.65; }
.complaint-alert > i { font-size: 1.15rem; }
.complaint-alert p { margin: 0; }
.complaint-alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.complaint-alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.complaint-alert--error { border-color: #ecb8b3; background: #fdf1ef; color: #8c1d16; }
.complaint-alert:focus { outline: 3px solid #e2908a; outline-offset: 3px; }

/* Envío */
.complaint-submit { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; padding: 1.3rem 1.6rem; border-radius: 12px; background: var(--pm-navy-950); color: #c4d3e3; }
.complaint-submit p { display: flex; gap: .55rem; flex: 1 1 260px; margin: 0; font-size: .8rem; line-height: 1.6; }
.complaint-submit p i { color: #9de1cb; }
.complaint-submit .btn { display: inline-flex; align-items: center; gap: .8rem; padding: .85rem 1.5rem; border-radius: 8px; font-size: .92rem; font-weight: 600; }
.complaint-submit .btn:disabled { opacity: .75; cursor: progress; }

/* Columna lateral ------------------------------------------------------------ */
.complaint-sidebar { display: flex; flex-direction: column; gap: 1.2rem; }
.complaint-steps { padding: .2rem 0 .4rem; }
.complaint-steps h2 { margin: .4rem 0 1rem; font: 700 1.25rem/1.3 var(--pm-font-header); color: var(--guide-ink); }
.complaint-steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.complaint-steps li { position: relative; padding: 0 0 1rem 2.6rem; counter-increment: step; }
.complaint-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e3efe9; color: var(--guide-teal); font: 600 .8rem var(--pm-font-header); }
.complaint-steps li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 32px; bottom: 4px; width: 1px; background: #c9dbd3; }
.complaint-steps strong { display: block; color: var(--guide-ink); font-size: .84rem; font-weight: 600; }
.complaint-steps span { display: block; margin-top: .15rem; color: var(--guide-muted); font-size: .75rem; line-height: 1.6; }
.complaint-emergency { padding: 1.1rem 1.2rem; border: 1px solid #f0c9a8; border-radius: 12px; background: #fff4ea; color: #6d3a10; }
.complaint-emergency h2 { display: flex; gap: .5rem; align-items: center; margin: 0 0 .35rem; font: 600 .95rem/1.4 var(--pm-font-header); }
.complaint-emergency p { margin: 0 0 .8rem; font-size: .76rem; line-height: 1.6; }
.complaint-emergency__numbers { display: grid; gap: .5rem; }
.complaint-emergency__numbers a { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .4rem; padding: .6rem .7rem; border: 1px solid #ebbf98; border-radius: 8px; background: #fff; color: #6d3a10; font-size: .74rem; }
.complaint-emergency__numbers a:hover { border-color: #c0662a; color: #9a3f0d; }
.complaint-emergency__numbers strong { margin-left: auto; font-size: 1rem; }
.complaint-contact { position: static; }

/* Denuncia recibida ---------------------------------------------------------- */
.complaint-received { max-width: 720px; margin: -1.2rem auto 4rem; padding: 2.5rem 2.6rem; border: 1px solid var(--guide-line); border-radius: 16px; background: #fff; box-shadow: 0 14px 40px #0821420f; text-align: center; position: relative; }
.complaint-received__icon { display: grid; place-items: center; width: 74px; height: 74px; margin: -4.6rem auto 1.2rem; border: 6px solid var(--guide-paper); border-radius: 50%; background: var(--guide-teal); color: #fff; font-size: 2.3rem; }
.complaint-received h1 { margin: .4rem 0 .7rem; color: var(--guide-ink); font: 700 clamp(1.7rem, 3vw, 2.2rem)/1.2 var(--pm-font-header); }
.complaint-received__lead { max-width: 520px; margin: 0 auto; color: var(--guide-muted); font-size: .92rem; line-height: 1.75; }
.complaint-folio { display: flex; flex-direction: column; gap: .2rem; max-width: 420px; margin: 1.8rem auto 0; padding: 1.2rem; border: 2px dashed #a7c5bd; border-radius: 12px; background: #f3f8f5; }
.complaint-folio span { color: var(--guide-teal); font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.complaint-folio strong { color: var(--guide-ink); font: 700 clamp(1.5rem, 4vw, 2rem)/1.2 var(--pm-font-header); letter-spacing: .04em; }
.complaint-folio small { color: var(--guide-muted); font-size: .74rem; line-height: 1.6; }
.complaint-received__next { display: grid; gap: .7rem; margin: 1.8rem 0 0; padding: 0; list-style: none; text-align: left; }
.complaint-received__next li { display: flex; gap: .8rem; align-items: start; padding: .9rem 1rem; border-radius: 9px; background: #f6f8f6; color: #3c5265; font-size: .82rem; line-height: 1.6; }
.complaint-received__next i { color: var(--guide-teal); font-size: 1.15rem; }
.complaint-received__next strong { color: var(--guide-ink); }
.complaint-received__actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1rem 1.6rem; margin-top: 2rem; }
.complaint-received__actions .btn { display: inline-flex; gap: .7rem; align-items: center; padding: .8rem 1.3rem; border-radius: 8px; font-size: .88rem; font-weight: 600; }
.complaint-received__link { display: inline-flex; gap: .5rem; align-items: center; color: var(--guide-teal); font-size: .85rem; font-weight: 500; }
.complaint-received__link:hover { color: #0e5652; text-decoration: underline; }

/* Responsivo ----------------------------------------------------------------- */
@media (max-width: 1199.98px) {
  .complaint-layout { grid-template-columns: minmax(0, 1fr) 290px; }
  .complaint-choices--reasons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .complaint-layout { grid-template-columns: minmax(0, 1fr); }
  .complaint-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .complaint-steps { grid-row: span 2; }
}
@media (max-width: 767.98px) {
  .complaint-sidebar { display: flex; }
  .complaint-step { padding: 1.2rem 1.1rem 1.3rem; }
  .complaint-choices--identity, .complaint-row { grid-template-columns: minmax(0, 1fr); }
  .complaint-map__canvas { height: 320px; }
  .complaint-received { padding: 2.2rem 1.3rem; }
}
@media (max-width: 575.98px) {
  .complaint-hero__facts li { font-size: .74rem; }
  .complaint-choices--reasons { grid-template-columns: minmax(0, 1fr); }
  .complaint-submit { padding: 1.2rem; }
  .complaint-submit .btn { width: 100%; justify-content: center; }
  .complaint-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .complaint-map__toolbar .complaint-map__button { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .complaint-choice, .complaint-reason, .complaint-choice::after, .complaint-reason::after, .complaint-drop { transition: none; }
}
