/* =========================

STYLE.CSS

========================= */


/* =========================
   VARIABILI GLOBALI
========================= */
:root{
  --bg: #f4f6f8;
  --text: #0f172a;
  --white: #ffffff;
  --green: #2e7d32;
  --blue: #0277bd;
  --shadow: 0 10px 30px rgba(0,0,0,.18);
}

*{ box-sizing: border-box; }

body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===================================
   HOME HERO - IMMAGINE STATICA (NO WATER)
   =================================== */

.page-home .hero {
  position: relative;
  width: 100vw;
  height: calc(100vw / 3);  /* forza altezza = larghezza/3 */
  max-height: 500px;        /* limita su schermi grandi */
  overflow: hidden;
}

.hero-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-canvas-wrap canvas {
  display: block;
}

/* Manteniamo overlay e contenuti sopra l'immagine */
.page-home .hero-overlay,
.page-home .hero-content {
  position: absolute;
  inset: 0;
}

/* ===================================
   HERO TEXT - CENTRATO E LEGGIBILE
   =================================== */

.page-home .hero-content {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;
  justify-content: center;   /* centro verticale */
  align-items: center;       /* centro orizzontale */

  text-align: center;
  color: #ffffff;
  z-index: 2;                /* sopra immagine e overlay */
}

.page-home .hero-content h1 {
  font-size: clamp(1.6rem, 3vw, 3rem);
  font-weight: 800;          /* carattere spesso */
  margin: 0 0 0.4em 0;
  text-transform: uppercase;

  text-shadow:
    0 4px 8px rgba(0,0,0,0.8),
    0 4px 10px rgba(0,0,0,0.8);
}

.page-home .hero-content h2 {
  font-size: clamp(1.1rem, 2vw, 1.8rem);
  font-weight: 600;
  margin: 0;

  text-shadow:
    0 4px 8px rgba(0,0,0,0.8);
}

/* ===================================
   HERO CANVAS PER WATER
   =================================== */
   
.hero-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}


/* =========================
   LAYOUT GENERICO
========================= */
.main{
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px;
}

.page{
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.page h1{
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
}

/* ===============================
   HEADINGS GLOBALI
   =============================== */

h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1e88e5;
  margin-bottom: 14px;
  padding-bottom: 8px;
  position: relative;
}

/* Riga sotto h3 – standard */
h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background-color: #1e88e5;
}	

/* =========================
   TOP BAR
========================= */
.topbar{
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  background: linear-gradient(90deg, #22c55e, #0284c7);
  color: white;
  font-weight: 800;
}

.topbar a{
  color: white;
  font-size: 20px;
  margin-left: 16px;
  text-decoration: none;
}

/* =========================
   CARD
========================= */
.card{
  background: white;
  border-radius: 18px;
  padding: 28px 32px;
  box-shadow: 0 14px 35px rgba(0,0,0,.12);
}

.spacer{ height: 28px; }

/* =========================
   GRIGLIE
========================= */
.grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.grid-3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

/* =========================
   FORM
========================= */
label{
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid #cbd5e1;
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}


.actions{
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  margin-top: 24px;
}

/* Protocollo evidenziato */
#protocollo{
  background: #b91c1c;      /* rosso */
  color: #000;             /* nero (black) */
  font-weight: 900;
  text-align: center;
  letter-spacing: .5px;
  border: 2px solid rgba(0,0,0,.25);
}


/* =========================
   BUTTONS
========================= */
.btn{
  border-radius: 16px;
  padding: 18px 16px;
  min-height: 64px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}


.btn-green{ background: var(--green); color: white; }
.btn-blue{ background: var(--blue); color: white; }
.btn-outline{
  background: white;
  color: var(--text);
  border: 2px solid #94a3b8;
}

#protocollo{
  background: #b91c1c;      /* rosso istituzionale */
  color: #ffffff;           /* testo bianco */
  font-weight: 900;         /* più “cicciotto” di bold */
  font-size: 18px;
  letter-spacing: 1px;
  text-align: center;
  border: none;
}

.btn-purple {
  background: #9b59b6;
  color: white;
}

.btn-purple:hover {
  background: #8e44ad;
}

/* =========================
   HOME – LOGOUT BUTTON
========================= */

.page-home .btn-logout{
  padding: 4px 14px !important;
  min-height: unset !important;
  height: auto !important;
  line-height: 1.1;
  font-size: 13px;
  font-weight: 900;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* =========================
   RICERCA – FULL WIDTH
========================= */
.page-ricerca .main{
  max-width: none;
  padding: 32px 32px 60px;
}

.card-results{ padding: 0; }

/* =========================
   TABELLA RISULTATI
========================= */
.results-table-wrapper{
  max-height: 60vh;
  overflow: auto;
}

.results-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.results-table th,
.results-table td{
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.results-table thead{
  position: sticky;
  top: 0;
  background: #f1f5f9;
}

.results-table td:nth-child(4){
  white-space: normal;
  min-width: 220px;
}

.status{
  font-weight: 800;
  color: #16a34a;
}

.link-protocollo{
  font-weight: 800;
  color: #0369a1;
  text-decoration: none;
}

/* =========================
   HOME – CTA
========================= */

.page-home .cta{
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 20px;
}

.page-home .btn{
  min-height: 72px;
  padding: 20px 18px;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
}

/* Responsive Home */
@media (max-width: 900px){
  .page-home .cta{
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px){
  .page-home .cta{
    grid-template-columns: 1fr;
  }
}

.page-home .btn-outline{
  color: #334155;
  border-color: #94a3b8;
}

.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal.hidden{ display: none; }

.modal-content{
  background: white;
  padding: 28px;
  border-radius: 16px;
  width: 320px;
}

/* =========================
   HOME – UTENTE LOGGATO
========================= */

.hero-user{
  position: absolute;
  top: 18px;
  right: 24px;
  font-weight: 900;
  letter-spacing: .5px;
  color: #fde047;        /* giallo istituzionale */
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  font-size: 18px;
}

/* =========================
   MODAL LOGIN
========================= */

.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden{
  display: none;
}

.modal-content{
  background: white;
  border-radius: 16px;
  padding: 28px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
  position: relative;
}

.modal-content h2{
  margin-top: 0;
  margin-bottom: 18px;
}

.modal-content label{
  margin-top: 12px;
}

.modal-content button{
  width: 100%;
  margin-top: 20px;
}

.modal-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-close{
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #475569;
}

.modal-close:hover{
  text-decoration: underline;
}

.register-link{
  margin-top: 14px;
  font-size: 14px;
}

.register-link a{
  font-weight: 800;
  color: #0277bd;
  text-decoration: none;
}

.register-link a:hover{
  text-decoration: underline;
}

.hidden{
  display: none !important;
}

/* =========================
   PAGINA GESTIONE INTERVENTO
========================= */

.intervento-page {
  padding: 20px;
}

/* HEADER */
.intervento-header {
  display: grid;
  grid-template-columns: auto 1fr 2fr auto;
  gap: 20px;
  align-items: center;
  padding: 16px;
  background: #eef5f8;
  border-radius: 12px;
}

.protocollo {
  font-size: 32px;
  font-weight: 900;
  color: #003a8f;
}

/* CORPO */
.intervento-body {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

/* STELLINE E BIDONCINI */
.op-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.star {
  cursor: pointer;
  font-size: 18px;
}

.trash {
  cursor: pointer;
  color: #c00;
}
/* ===============================
   AUTOCOMPLETE (stile Google-like)
   =============================== */

.autocomplete-box {
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  font-size: 13px;
  overflow: hidden;
}

.autocomplete-item {
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.autocomplete-item:hover {
  background: #e3f2fd;
}

.autocomplete-item.active {
  background-color: #1e90ff;
  color: white;
  font-weight: 700;
}

/* ===================================
   HERO WATER EFFECT (OPTIONAL)
   =================================== */

.page-home .hero-water {
  position: absolute;
  inset: 0;
  z-index: 1;        /* sopra immagine, sotto overlay/testo */
  pointer-events: none;
}

.page-home .hero-water canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===================================
   FOOTER HOME PAGE
   =================================== */
   
.credits-box {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.credits-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

.credits-text {
  margin: 10px 0;
  font-size: 14px;
  color: #bdc3c7;
}

.credits-name {
  font-size: 18px;
  color: #0da128;
  font-weight: 600;
  letter-spacing: 1px;
}

.credits-copy {
  margin-top: 10px;
  font-size: 11px;
  color: #7f8c8d;
  font-style: italic;
}

/* ======================================================
   INTERVENTI CHIUSI - Righe verdi in ricerca
   ====================================================== */
tr.intervento-chiuso {
    background-color: #90EE90 !important;
}

tr.intervento-chiuso:hover {
    background-color: #7FD87F !important;
}

/* ======================================================
   RICERCA - Evidenziazione interventi chiusi
   ====================================================== */

.results-table tr.intervento-chiuso {
    background-color: #d4edda !important; /* Verde chiaro */
}

.results-table tr.intervento-chiuso td.status {
    color: #155724 !important; /* Verde scuro per testo "chiuso" */
    font-weight: bold;
}

.results-table tr.intervento-chiuso:hover {
    background-color: #c3e6cb !important; /* Verde leggermente più scuro al hover */
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}


.gestione-intervento {
    max-width: 1200px;
    margin: auto;
    padding: 20px;
}

.azioni-intervento button {
    margin-right: 8px;
}

.lista li {
    margin-bottom: 6px;
}

.foto-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.foto-grid img {
    border: 1px solid #ccc;
    border-radius: 4px;
}

h3::after {
  background: red !important;
  height: 1px !important;
}

/* ORDINAMENTO COLONNE RICERCA */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px;
}

th.sortable:hover {
  background-color: #e8e8e8;
}

.sort-arrow {
  margin-left: 5px;
  font-size: 12px;
}