/**
 * MINOMO — Citizen Reports ("MINOMO Report") page styles
 * WS5 — 2026-07-04
 * Coerente con minomo-2026.css (dark, --orange #F58220, .m-card ecc.)
 * e col pattern poll-detail.css (WS6). WCAG 2.1 AA: contrasto ≥4.5:1,
 * target ≥44px, focus visibile.
 */

/* ── Page shell ──────────────────────────────────────────── */
.rp-page {
  min-height: 100dvh;
  background: var(--bg, #000);
  color: var(--t1, #F5F5F7);
  padding-bottom: calc(env(safe-area-inset-bottom) + 96px);
  position: relative;
}

.rp-back-row { padding: 16px 20px 0; }

.rp-back, .rp-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--orange, #F58220);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  min-height: 44px;
  padding: 4px 0;
  border-radius: 6px;
}
.rp-back:focus-visible, .rp-btn-back:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 3px; }

/* ── Header ──────────────────────────────────────────────── */
.rp-header { padding: 8px 20px 0; }
.rp-title { font-size: 1.375rem; font-weight: 700; margin: 0 0 4px; color: var(--t1, #F5F5F7); }
.rp-city-label { font-size: 0.875rem; color: var(--text-secondary, #8E8E93); margin: 0 0 12px; }

/* ── Tabs ────────────────────────────────────────────────── */
.rp-tabs {
  display: flex;
  gap: 8px;
  padding: 0 20px 14px;
}
.rp-tab {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary, #8E8E93);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.rp-tab-active { background: var(--orange, #F58220); color: var(--on-orange); }
.rp-tab:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }

.rp-panel[hidden] { display: none; }

/* ── Map ─────────────────────────────────────────────────── */
/* `isolation: isolate` NON è cosmetico e non va rimosso: contiene i pane di
   Leaflet in uno stacking context proprio. Leaflet mette da sé
   `position: relative` sul contenitore ma NESSUNO `z-index`, quindi il
   contenitore non apre uno stacking context e i suoi discendenti escono a
   competere nella radice con i loro z-index cablati nel CSS della libreria:
   pane 400, controlli 800, angoli 1000. Sono tutti più alti dell'overlay del
   form (z-index 100) e della FAB (40), che quindi finivano SOTTO una mappa
   che nel flusso sta prima di loro — ed è il motivo per cui la mappa della
   lista compariva sopra le categorie del form "Nuova segnalazione".
   Isolando, la mappa compete come un blocco solo e l'ordine torna quello
   del documento. Vale per tutte e tre le mappe della pagina: la lista
   copriva il form, il picker coprirebbe l'header sticky del form, il
   dettaglio la FAB. */
.rp-map,
.rp-picker-map,
.rp-detail-map {
  isolation: isolate;
}

.rp-map {
  width: 100%;
  height: 260px;
  border-radius: 16px;
  margin: 0 20px 16px;
  width: calc(100% - 40px);
  overflow: hidden;
  background: var(--surf, #141416);
}

.rp-pin-wrap { background: transparent; border: none; }
.rp-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  border: 2px solid #fff;
}
.rp-pin span, .rp-pin { font-size: 0.9rem; }
.rp-pin { color: #fff; }

.rp-popup { font-size: 0.8125rem; line-height: 1.4; }
.rp-popup-status { color: var(--text-secondary, #8E8E93); }

/* ── List ────────────────────────────────────────────────── */
.rp-list { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }

.rp-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surf, #141416);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255,255,255,0.06);
  min-height: 44px;
}
.rp-card:hover, .rp-card:focus-visible { border-color: var(--orange, #F58220); }
.rp-card:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }

.rp-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(245, 130, 32, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.rp-card-body { flex: 1; min-width: 0; }
.rp-card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.rp-card-category { font-size: 0.9375rem; font-weight: 600; color: var(--t1, #F5F5F7); }
.rp-card-meta { font-size: 0.8125rem; color: var(--text-secondary, #8E8E93); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.rp-card-dot { opacity: 0.6; }
.rp-card-note { font-size: 0.8125rem; color: var(--text-secondary, #8E8E93); margin: 4px 0 0; line-height: 1.4; }
.rp-chev { color: var(--text-secondary, #8E8E93); font-size: 1.25rem; align-self: center; }

.rp-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary, #8E8E93);
  font-size: 0.9375rem;
}

.rp-loading { padding: 48px 20px; text-align: center; color: var(--text-secondary, #8E8E93); font-size: 0.9375rem; }

.rp-error { padding: 32px 20px; text-align: center; }
.rp-error p { color: var(--text-secondary, #8E8E93); margin: 0 0 20px; font-size: 0.9375rem; line-height: 1.5; }

/* ── Badges (severity / status) ────────────────────────────── */
.rp-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rp-severity-low    { background: rgba(142,142,147,0.15); color: #C7C7CC; }
.rp-severity-medium { background: rgba(245,130,32,0.12);  color: var(--orange, #F58220); }
.rp-severity-high   { background: rgba(255,59,48,0.12);   color: #FF453A; }

.rp-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.rp-status-new          { background: rgba(10,132,255,0.12);  color: #0A84FF; }
.rp-status-received     { background: rgba(245,130,32,0.12);  color: var(--orange, #F58220); }
.rp-status-in_progress  { background: rgba(245,130,32,0.12);  color: var(--orange, #F58220); }
.rp-status-resolved     { background: rgba(52,199,89,0.12);   color: #34C759; }
.rp-status-rejected     { background: rgba(255,255,255,0.08); color: #aaa; }
/* Chiusi senza esito per il cittadino, come `rejected`: stesso grigio. Senza
   queste due righe il badge usciva con la sola base, cioè senza colore né
   sfondo — invisibile come stato. */
.rp-status-not_competent{ background: rgba(255,255,255,0.08); color: #aaa; }
.rp-status-duplicate    { background: rgba(255,255,255,0.08); color: #aaa; }

/* ── Login prompt (mine tab) ───────────────────────────────── */
.rp-login-prompt { padding: 32px 4px; text-align: center; }
.rp-login-prompt p { color: var(--text-secondary, #8E8E93); margin: 0 0 16px; font-size: 0.9375rem; }

/* ── FAB ─────────────────────────────────────────────────── */
.rp-fab {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  min-height: 52px;
  border: none;
  border-radius: 16px;
  background: var(--orange, #F58220);
  color: var(--on-orange);
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 6px 20px rgba(245,130,32,0.4);
  cursor: pointer;
  z-index: 40;
}
.rp-fab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rp-fab[hidden] { display: none; }

/* ── Detail view ─────────────────────────────────────────── */
.rp-content {
  margin: 16px 16px 0;
  background: var(--surf, #141416);
  border-radius: 18px;
  padding: 24px 20px 28px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

.rp-detail-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(245,130,32,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.rp-detail-map {
  width: 100%;
  height: 180px;
  border-radius: 14px;
  overflow: hidden;
  margin: 4px 0 16px;
}

.rp-detail-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary, #8E8E93);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px;
}

.rp-section-title { font-size: 0.9375rem; font-weight: 700; margin: 0 0 8px; color: var(--t1, #F5F5F7); }

.rp-status-note {
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border-left: 2px solid var(--orange, #F58220);
  border-radius: 10px;
  margin: 0 0 20px;
}
.rp-status-note p { margin: 0; font-size: 0.875rem; color: var(--t1, #F5F5F7); line-height: 1.5; }

/* WS7 §4.3 — "Aggiornamenti del Comune": public notes, newest first. */
.rp-notes { margin: 0 0 20px; }
.rp-notes-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rp-note-item {
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border-left: 2px solid var(--orange, #F58220);
  border-radius: 10px;
}
.rp-note-body { margin: 0 0 6px; font-size: 0.875rem; color: var(--t1, #F5F5F7); line-height: 1.5; }
.rp-note-date { color: var(--text-secondary, #8E8E93); font-size: 0.8125rem; }

.rp-timeline { margin: 0 0 20px; }
.rp-timeline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rp-timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--t1, #F5F5F7);
}
.rp-timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange, #F58220);
  flex-shrink: 0;
}
.rp-timeline-status { font-weight: 600; }
.rp-timeline-date { color: var(--text-secondary, #8E8E93); font-size: 0.8125rem; margin-left: auto; }

.rp-confirm-zone { margin-top: 8px; }

/* ── Buttons (shared list/detail/form) ─────────────────────── */
.rp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 180ms ease, transform 100ms ease;
  margin-bottom: 10px;
}
.rp-btn:active { transform: scale(0.98); }
.rp-btn:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }
.rp-btn-primary { background: var(--orange, #F58220); color: var(--on-orange); }
.rp-btn-primary:disabled, .rp-btn-primary[aria-disabled="true"] { opacity: 0.38; cursor: not-allowed; }
.rp-btn-secondary { background: rgba(255,255,255,0.08); color: var(--t1, #F5F5F7); }

.rp-hint { font-size: 0.8125rem; color: var(--text-secondary, #8E8E93); margin: 0 0 12px; min-height: 18px; }
.rp-hint-error { color: #FF453A; }

/* ── Form overlay ───────────────────────────────────────────── */
#rp-form-overlay:empty { display: none; }
/* z-index sopra la barra di navigazione condivisa (`.m-nav`, z-index 100 in
   minomo.css) — stessa scelta e stesso motivo delle action sheet della pagina
   merchant, che stanno a 1100. A pari z-index vinceva la barra, perche' viene
   dopo nel DOM: un cittadino a meta' di una segnalazione poteva toccare
   "Esplora" e perdere la bozza senza un avviso. Questo e' un modale: finche'
   e' aperto l'unica uscita e' la ✕, che chiude in modo esplicito. */
.rp-form-overlay-inner {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--bg, #000);
  overflow-y: auto;
  padding-bottom: calc(env(safe-area-inset-bottom) + 40px);
}

.rp-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 8px;
  position: sticky;
  top: 0;
  background: var(--bg, #000);
  z-index: 2;
}
.rp-form-title { font-size: 1.125rem; font-weight: 700; margin: 0; color: var(--t1, #F5F5F7); }
.rp-form-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--t1, #F5F5F7);
  font-size: 1rem;
  cursor: pointer;
}
.rp-form-close:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }

.rp-form-body { padding: 8px 20px 0; }

.rp-step { margin-bottom: 24px; }
.rp-step[hidden] { display: none; }
.rp-step-title { font-size: 1rem; font-weight: 700; margin: 0 0 10px; color: var(--t1, #F5F5F7); }
.rp-step-hint { font-size: 0.8125rem; color: var(--text-secondary, #8E8E93); margin: 0 0 12px; line-height: 1.5; }

/* Avviso emergenze: deliberatamente più marcato di .rp-step-hint — è l'unico
   messaggio del form che riguarda l'incolumità, non l'usabilità. */
.rp-emergency-notice {
  font-size: 0.8125rem;
  line-height: 1.45;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.28);
  color: #B3261E;
  font-weight: 500;
}
@media (prefers-color-scheme: dark) {
  .rp-emergency-notice {
    background: rgba(255, 69, 58, 0.14);
    border-color: rgba(255, 69, 58, 0.36);
    color: #FF9A93;
  }
}

/* Chips (category / severity) */
.rp-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.rp-chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--t1, #F5F5F7);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 150ms ease, background 150ms ease;
}
.rp-chip:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }
.rp-chip-selected { border-color: var(--orange, #F58220); background: rgba(245,130,32,0.12); }
.rp-chip-severity { min-width: 90px; justify-content: center; }

/* Map-picker */
/* Messaggio mostrato al posto della mappa quando non conosciamo il centro:
   meglio dirlo che centrare su coordinate arbitrarie. */
.rp-picker-nocenter {
  margin: 0;
  padding: 20px 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
  color: var(--text-secondary, #8E8E93);
}

.rp-picker-map {
  width: 100%;
  height: 260px;
  border-radius: 16px;
  overflow: hidden;
  margin: 4px 0 10px;
  background: var(--surf, #141416);
}
.rp-picker-distance { font-size: 0.8125rem; color: var(--text-secondary, #8E8E93); margin: 0 0 14px; }

/* Description textarea */
.rp-textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--t1, #F5F5F7);
  font-size: 0.9375rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 6px;
}
.rp-textarea:focus-visible, .rp-textarea:focus { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }
.rp-char-counter { font-size: 0.75rem; color: var(--text-secondary, #8E8E93); margin: 0 0 14px; text-align: right; }

/* Captcha */
.rp-captcha-row { margin: 4px 0 16px; }
.rp-captcha-row label { display: block; font-size: 0.875rem; color: var(--t1, #F5F5F7); margin-bottom: 8px; font-weight: 600; }
.rp-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--t1, #F5F5F7);
  font-size: 1rem;
  font-family: inherit;
}
.rp-input:focus-visible, .rp-input:focus { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }

/* Dedup */
.rp-dedup-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.rp-dedup-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}
.rp-dedup-card .rp-btn { margin-bottom: 0; }

/* Success */
.rp-step-success { text-align: center; padding-top: 20px; }
.rp-success-check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(52,199,89,0.12);
  color: #34C759;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* ── Home card (app.html) ──────────────────────────────────── */
.h-reports-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 16px 0;
  background: var(--surf, #141416);
  border: 1px solid rgba(245, 130, 32, 0.25);
  border-radius: 16px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  min-height: 72px;
  transition: border-color 150ms ease, background 150ms ease;
}
.h-reports-card:hover, .h-reports-card:focus-visible {
  border-color: var(--orange, #F58220);
  background: rgba(245, 130, 32, 0.04);
}
.h-reports-card:focus-visible { outline: 2px solid var(--orange, #F58220); outline-offset: 2px; }

/* Guest-mode (Apple 5.1.1(v) fix, 2026-07-14): home.js renders this card as
   a <button> (instead of an <a href="/reports">) when the "fai una
   segnalazione" action requires sign-in, so tapping it opens the on-demand
   accedi/registrati prompt instead of navigating. Reset native button
   chrome so it matches the <a> variant pixel-for-pixel. */
button.h-reports-card {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.h-reports-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 130, 32, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange, #F58220);
}

.h-reports-text { flex: 1; min-width: 0; }
.h-reports-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--orange, #F58220);
  margin: 0 0 3px;
}
.h-reports-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--t1, #F5F5F7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0;
}
.h-reports-chev { flex-shrink: 0; color: var(--text-secondary, #8E8E93); font-size: 1rem; }

.h-reports-zone { margin: 0 0 8px; }

/* ── Screen-reader only ────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
