/*
 * Viste: ricerca delle strutture, preventivo e conferma.
 */

/* ── Ricerca strutture ── */
.struct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.struct {
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  background: var(--superficie);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
}
.struct:hover { transform: translateY(-4px); border-color: #c7d2fe; box-shadow: var(--shadow-lg); }
.struct-img { height: 160px; background-size: cover; background-position: center; position: relative; }
.struct-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.38));
}
/* etichetta sopra la foto (percorso guidato e ricerca rapida): sfondo bianco pieno e ombra,
   leggibile su qualsiasi foto, chiara o scura */
.badge.on-photo {
  background: var(--superficie) !important;
  border-color: transparent !important;
  box-shadow: 0 1px 8px rgba(0,0,0,0.45);
  font-weight: 800;
  padding: 3px 9px;
}
/* Barra badge in cima alla foto: fonte a sinistra, stato a destra */
.foto-badge-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}
.foto-badge-bar > span { pointer-events: auto; }
.struct-img .stars {
  position: absolute;
  bottom: 12px;
  left: 12px;
  color: var(--testo-inverso);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
  background: rgba(2,6,23,0.62);
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}
.struct-img .stars::before { content: "★ "; color: var(--ice-300); }
.struct-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.struct-name { font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.struct-meta { font-size: 12px; color: var(--slate-400); display: flex; gap: 14px; flex-wrap: wrap; }
.struct-meta .item { display: flex; align-items: center; gap: 5px; }
.struct-meta .item.dist { font-family: "JetBrains Mono", monospace; color: var(--blue-dark); }
.struct-pick {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--blue);
  border: 1px solid var(--blue);
  color: var(--testo-inverso);
}
.struct-pick:hover { background: var(--blue-dark); color: var(--testo-inverso); }
.struct-fade-in { animation: structIn 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
.struct.enriched { border-color: #9ad6ad; }
.struct.enriched::after {
  content: "+ prezzo da Booking";
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(16,185,129,0.45);
  animation: badgePulse 0.5s ease 3;
  background: #e7f6ec;
  color: var(--successo);
  border-color: #9ad6ad;
}
#struct-grid.struct-grid { grid-template-columns: 1fr; gap: 14px; }
#struct-grid .struct { flex-direction: row; align-items: stretch; cursor: default; }
#struct-grid .struct .struct-img { width: 232px; min-height: 200px; height: auto; flex-shrink: 0; }
#struct-grid .struct .struct-img::after {
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.30));
}
#struct-grid .struct-body { flex: 1; flex-direction: row; gap: 18px; padding: 18px 20px; }
.struct-info { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.struct-info .struct-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.struct-rating { font-size: 12px; font-weight: 700; color: var(--attenzione); }
.struct-facilities { display: flex; gap: 7px; flex-wrap: wrap; }
.fac-chip {
  font-size: 11px;
  color: var(--slate-400);
  background: #f1f5f9;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 2px 8px;
}
.struct-aside {
  width: 208px;
  flex-shrink: 0;
  border-left: 1px solid var(--glass-border);
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}
.score-ai {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 21px;
  color: var(--testo-inverso);
  box-shadow: 0 4px 12px rgba(16,24,40,0.16);
}
.score-ai.high { background: linear-gradient(135deg, #16a34a, var(--successo)); }
.score-ai.mid { background: linear-gradient(135deg, var(--informazione), #1d4ed8); }
.score-ai.low { background: linear-gradient(135deg, #d97706, var(--attenzione)); }
.score-ai-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate-500);
  font-weight: 700;
  margin-top: -2px;
}
.struct-aside .price {
  font-size: 23px;
  font-weight: 800;
  color: var(--slate-50);
  line-height: 1;
  margin-top: 4px;
}
.struct-aside .price small { font-size: 11px; font-weight: 500; color: var(--slate-500); }
.struct-aside .budget-ok { font-size: 11px; font-weight: 700; color: var(--successo); }
.struct-aside .budget-no { font-size: 11px; font-weight: 700; color: var(--attenzione); }
.struct-aside .phone-big {
  font-size: 13px;
  font-weight: 700;
  color: var(--successo);
  font-family: "JetBrains Mono", monospace;
}
.struct-aside .phone-missing { font-size: 11px; font-weight: 700; color: var(--attenzione); }
.struct-aside .struct-pick { width: 100%; padding: 9px 12px; text-align: center; justify-content: center; }

/* ── Preventivo ── */
/* minmax(0, ·) sulla colonna sinistra: senza, i campi larghi dell'editor delle tratte
   la allargano e spingono fuori il riepilogo a destra */
.quote-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 22px; }
.quote-grid > * { min-width: 0; }
.voci-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.voci-table th {
  text-align: left;
  padding: 10px 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--slate-500);
  border-bottom: 1px solid var(--glass-border);
}
.voci-table td { padding: 14px 12px; color: var(--slate-200); border-bottom: 1px solid var(--glass-border); }
.voci-table input[type="number"] {
  width: 70px;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  background: var(--superficie);
  border: 1px solid var(--glass-border-strong);
  color: var(--slate-100);
}
.voci-table .voce-name { font-weight: 600; }
.voci-table .voce-sub { font-size: 11px; color: var(--slate-500); }
.voci-table .price {
  font-family: "JetBrains Mono", monospace;
  text-align: right;
  font-weight: 600;
  color: var(--blue-dark);
}
.voci-table tr:hover td { background: var(--superficie-tenue); }
.voci-table .col-iniziale { padding: 14px 18px; }
.voci-table .a-destra { text-align: right; }
.voci-table .al-centro { text-align: center; }
.summary {
  border-radius: 12px;
  padding: 22px;
  align-self: start;
  position: sticky;
  top: 0;
  background: var(--superficie-tenue);
  border: 1px solid var(--glass-border);
}
.summary h4 {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 18px;
  color: var(--slate-500);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  color: var(--slate-300);
}
.summary-row.total {
  padding-top: 14px;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-50);
  border-top: 1px solid var(--glass-border-strong);
}
.summary-row .v { font-family: "JetBrains Mono", monospace; color: var(--slate-100); }
.summary-row.total .v { font-size: 22px; color: var(--blue-dark); }
.budget-bar { height: 6px; border-radius: 3px; overflow: hidden; margin: 14px 0 18px; background: #e2e8f0; }
.budget-fill {
  height: 100%;
  width: 45%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  box-shadow: none;
}
.budget-info {
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--slate-400);
}
.ptrat {
  position: relative;
  border: 1px solid var(--glass-border-strong);
  border-left: 4px solid var(--primary);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--superficie);
  box-shadow: 0 2px 10px rgba(15,23,42,0.05);
  transition: box-shadow .15s, border-color .15s;
}
.ptrat:hover { box-shadow: 0 6px 20px rgba(15,23,42,0.09); }
.ptrat.ptrat-unpriced {
  border-left-color: #f59e0b;
  background: linear-gradient(180deg, #fffdf7 0%, #fff 42%);
}
.pt-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--attenzione);
  background: #fef3c7;
  border: 1px solid #fde68a;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: auto;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
}
.ptrat-head { display: flex; gap: 9px; align-items: center; margin-bottom: 12px; }
.ptrat-head .pt-tipo {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--glass-border-strong);
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--superficie-tenue);
  color: var(--slate-100);
  cursor: pointer;
}
.ptrat-head .pt-comp {
  flex: 1;
  padding: 8px 11px;
  border: 1px solid var(--glass-border-strong);
  border-radius: 9px;
  font-size: 13px;
  background: var(--superficie);
}
.ptrat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ptrat-grid .lbl, .ptrat-row2 .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate-500);
  font-family: "JetBrains Mono", monospace;
  display: block;
  margin-bottom: 3px;
}
.ptrat-grid input, .ptrat-row2 input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--glass-border-strong);
  border-radius: 9px;
  font-size: 13px;
  background: var(--superficie);
  transition: border-color .12s, box-shadow .12s;
}
.ptrat-grid input:focus, .ptrat-row2 input:focus, .ptrat-head .pt-comp:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.ptrat-row2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.ptrat-del {
  border: none;
  background: var(--pericolo-sfondo);
  color: var(--pericolo);
  border-radius: 9px;
  padding: 8px 11px;
  cursor: pointer;
  font-size: 14px;
  transition: background .12s;
}
.ptrat-del:hover { background: var(--pericolo-sfondo-hover); }
.ptrat-search {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: var(--primary);
  color: var(--testo-inverso);
  border-radius: 9px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(79,70,229,0.28);
  transition: transform .1s, box-shadow .12s;
}
.ptrat-search:hover { box-shadow: 0 4px 14px rgba(79,70,229,0.4); }
.ptrat-search:active { transform: translateY(1px); }
.ptrat-search:disabled { opacity: .7; cursor: default; }
.ptrat-results { margin-top: 10px; display: none; }
.pt-head-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pt-head-bar h4 { font-size: 13px; font-weight: 800; color: var(--slate-100); }

/* ── Conferma ── */
.confirm-wrap { text-align: center; padding: 40px 20px; }
.confirm-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 48px;
  color: white;
  animation: pulseIcon 2.4s ease infinite;
  background: var(--blue);
  box-shadow: 0 8px 30px rgba(37,99,235,0.35);
}
.confirm-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.confirm-sub { font-size: 14px; margin-bottom: 28px; color: var(--slate-400); }
.confirm-meta {
  display: inline-flex;
  gap: 32px;
  border-radius: 12px;
  padding: 18px 26px;
  margin: 0 auto;
  text-align: left;
  background: var(--superficie-tenue);
  border: 1px solid var(--glass-border);
}
.confirm-meta .col label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 4px;
}
.confirm-meta .col span { font-size: 14px; font-weight: 600; color: var(--slate-100); }
