/* ═══════════════════════════════════════════════════
   CASA-ASTE.IT — Stili pagina dettaglio annuncio
   ═══════════════════════════════════════════════════ */

/* ─── BREADCRUMB ──────────────────────────────────────────── */
.breadcrumb-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 32px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}
.breadcrumb-bar a { color: var(--muted); transition: color .15s; }
.breadcrumb-bar a:hover { color: var(--blue); }
.breadcrumb-bar .current { color: var(--text); font-weight: 500; }
.breadcrumb-bar span { opacity: .4; }

/* ─── GALLERIA ────────────────────────────────────────────── */
.gallery {
  background: #0A1628; overflow: hidden; display: flex; flex-direction: column;
  /* Allineata al corpo pagina (.detail-body), non più a tutto schermo */
  width: calc(100% - 64px); max-width: 1036px;
  margin: 24px auto 0; border-radius: 16px;
  box-shadow: 0 6px 24px rgba(2,29,80,.14);
}
.gallery-main {
  position: relative; display: flex; align-items: center;
  justify-content: center; background: #0D2040; overflow: hidden;
  height: clamp(300px, 62vw, 640px);
}
/* Sfondo: la stessa foto, sfocata, così la foto intera non lascia bande vuote */
.gallery-main::before {
  content: ''; position: absolute; inset: -30px;
  background: var(--bg-img, none) center / cover no-repeat;
  filter: blur(28px) brightness(.6);
}
/* Foto intera (contain): nessun ritaglio e nessuna deformazione */
.gallery-main img {
  position: relative; z-index: 1;
  width: 100%; height: 100%; object-fit: contain;
  cursor: zoom-in;
}
.gallery-badge {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  background: var(--blue); color: white;
  font-size: 10px; font-weight: 700; padding: 4px 12px;
  border-radius: 8px; text-transform: uppercase; letter-spacing: .5px;
  box-shadow: 0 2px 10px rgba(2,115,252,.5);
}
.gallery-heart {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 17px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2); transition: transform .15s;
}
.gallery-heart:hover { transform: scale(1.15); }
.gallery-heart.saved { color: #e24b4a; }
.gallery-count {
  position: absolute; bottom: 14px; right: 16px;
  background: rgba(0,0,0,.55); color: white;
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 8px; backdrop-filter: blur(4px);
}
.gallery-thumbs {
  display: flex; gap: 4px; padding: 4px;
  background: #0A1628; overflow-x: auto; height: 70px;
}
.gallery-thumb {
  position: relative;
  flex-shrink: 0; width: 100px; height: 62px; overflow: hidden;
  border-radius: 4px; cursor: pointer; opacity: .55;
  border: 2px solid transparent; transition: opacity .15s, border-color .15s;
}
.gallery-thumb.active { opacity: 1; border-color: var(--blue); }
.gallery-thumb:hover { opacity: .85; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-lock {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(10,22,40,.8); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.gallery-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; min-height: 300px;
  background: var(--blue-ultra); color: var(--muted); font-size: 13px;
}

/* ─── LAYOUT CORPO ────────────────────────────────────────── */
.detail-body {
  display: grid; grid-template-columns: 1fr 320px; gap: 0;
  max-width: 1100px; margin: 0 auto; padding: 0 32px; align-items: start;
}

/* ─── COLONNA SINISTRA ────────────────────────────────────── */
.detail-left { padding: 28px 32px 48px 0; border-right: 1px solid var(--border); }
.detail-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--blue); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.detail-eyebrow::before { content: ''; width: 16px; height: 2px; background: var(--blue); border-radius: 1px; }
.detail-title { font-size: 24px; font-weight: 700; line-height: 1.25; margin-bottom: 8px; }
.detail-location { font-size: 13px; color: var(--muted); margin-bottom: 22px; }

/* Key stats */
.key-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 28px; }
.ks { background: var(--blue-ultra); border-radius: 10px; padding: 14px; text-align: center; }
.ks-val { font-size: 20px; font-weight: 700; color: var(--blue); line-height: 1; }
.ks-lbl { font-size: 10px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* Dotazioni in evidenza (Ascensore, Garage, Abitazione su 2 livelli) */
.key-stats + .dotazioni-evidenza { margin-top: -14px; }
.dotazioni-evidenza { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.dot-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--blue); color: var(--blue);
  font-size: 14px; font-weight: 700; line-height: 1;
  box-shadow: var(--shadow-sm);
}
.dot-ico { font-size: 18px; line-height: 1; }
.info-si { color: #15803D; }

/* Sezioni */
.detail-section { margin-bottom: 28px; }
.detail-section-title {
  font-size: 14px; font-weight: 700; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid rgba(2,115,252,.1);
}
.detail-desc { font-size: 13px; color: var(--muted); line-height: 1.8; }

/* Info grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: .5px solid rgba(2,115,252,.07);
}
.info-lbl { font-size: 12px; color: var(--muted); }
.info-val { font-size: 12px; font-weight: 600; }

/* Documenti */
.docs-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--blue-ultra); border-radius: 10px;
  padding: 11px 14px; transition: background .15s;
}
.doc-item:hover { background: #D5E8FF; }
.doc-locked { opacity: .6; }
.doc-icon {
  width: 32px; height: 32px; background: var(--blue); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-info { flex: 1; }
.doc-name { font-size: 13px; font-weight: 600; }
.doc-size { font-size: 11px; color: var(--muted); }
.doc-dl { font-size: 12px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.doc-lock { font-size: 11px; color: var(--muted); white-space: nowrap; }
.doc-lock a { color: var(--blue); }

/* ─── MAPPA LEAFLET ───────────────────────────────────────── */
.leaflet-map {
  height: 280px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 1;
}
.map-address {
  font-size: 12px; color: var(--muted); padding: 0 2px;
  margin-top: 8px;
}
/* Suggerimento "due dita" sulla mappa (touch) */
.map-wrap { position: relative; }
.map-gesture-hint {
  position: absolute; inset: 0 0 10px 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center;
  border-radius: 14px;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 15px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.map-gesture-hint.show { opacity: 1; }

/* Override Leaflet per arrotondare i bordi */
.leaflet-container { border-radius: 14px; font-family: 'DM Sans', sans-serif; }
.leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.detail-sidebar { padding: 28px 0 48px 28px; display: flex; flex-direction: column; gap: 16px; }

/* Price box */
.price-box {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0050B8, #0273FC 60%, #2E9CFF);
  border-radius: 16px; padding: 22px 22px 18px; color: white;
}
.pb-geo1 { position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; border: 28px solid rgba(255,255,255,.07); }
.pb-geo2 { position: absolute; right: 40px; bottom: -20px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.05); }
.pb-label { font-size: 10px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255,255,255,.7); margin-bottom: 5px; position: relative; }
.pb-price { font-size: 30px; font-weight: 700; line-height: 1; position: relative; }
.pb-saving { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.15); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; margin-top: 8px; position: relative; }
.pb-valore { font-size: 11px; color: rgba(255,255,255,.65); margin-top: 8px; position: relative; }
.pb-divider { height: .5px; background: rgba(255,255,255,.2); margin: 14px 0; position: relative; }
.pb-scad { font-size: 12px; color: rgba(255,255,255,.75); position: relative; }
.pb-scad strong { color: white; }
.pb-extra { margin-top: 12px; position: relative; }
.pb-extra-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: rgba(255,255,255,.75); padding: 4px 0; }
.pb-extra-row strong { color: white; font-size: 13px; font-weight: 700; }
.cta-primary-btn {
  display: block; width: 100%; text-align: center;
  background: white; color: var(--blue); font-weight: 700;
  border: none; border-radius: 10px; padding: 13px;
  font-size: 14px; margin-top: 16px; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
  transition: transform .15s, box-shadow .15s;
  position: relative; text-decoration: none;
}
.cta-primary-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.cta-secondary-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; text-align: center;
  background: transparent; color: white;
  border: 1.5px solid rgba(255,255,255,.35); border-radius: 10px;
  padding: 11px; font-size: 13px; font-weight: 600;
  margin: 8px 0 6px; cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: background .15s; position: relative;
}
.cta-secondary-btn:hover { background: rgba(255,255,255,.1); }

/* Il bottone "Salva nei preferiti" nel box prezzo riusa la classe
   .gallery-heart (per il toggle JS) insieme a .cta-secondary-btn, ma
   .gallery-heart è pensata per il cuoricino assoluto sopra le foto
   (position:absolute; top/right:16px). Qui azzeriamo quegli scostamenti
   con una regola più specifica, così il bottone resta centrato nel
   normale flusso invece di apparire spostato di 16px. */
.cta-secondary-btn.gallery-heart {
  position: static;
  top: auto; right: auto;
  width: 100%; height: auto;
  border-radius: 10px;
  font-size: 13px;
}

/* Icona cuore SVG: forma fissa, niente asimmetrie di font come con i
   caratteri ♥/♡/❤️ (ogni font gestisce lo spazio attorno diversamente,
   causando quello sbilanciamento ottico che si vede con text-align/flex). */
.cta-heart-icon { width: 16px; height: 16px; flex-shrink: 0; }
.cta-heart-icon path { fill: none; stroke: currentColor; stroke-width: 2; transition: fill .15s; }
.gallery-heart.saved .cta-heart-icon path { fill: currentColor; }

/* Simulatore mutuo */
.mutuo-box {
  background: white; border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 18px 16px;
}
.mutuo-riga { margin-top: 14px; }
.mutuo-riga-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mutuo-riga-head label { font-size: 12px; color: var(--muted); font-weight: 500; }
.mutuo-riga-val { font-size: 12px; font-weight: 700; color: var(--blue); }

.mutuo-riga input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; border-radius: 3px;
  background: var(--blue-ultra); outline: none; cursor: pointer;
}
.mutuo-riga input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 2px 6px rgba(2,115,252,.4);
  cursor: pointer;
}
.mutuo-riga input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: none;
  background: var(--blue); box-shadow: 0 2px 6px rgba(2,115,252,.4);
  cursor: pointer;
}

.mutuo-risultato {
  margin-top: 16px; padding: 14px; border-radius: 10px;
  background: var(--blue-ultra); text-align: center;
}
.mutuo-risultato-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.mutuo-risultato-val { font-size: 22px; font-weight: 700; color: var(--blue); margin-top: 4px; }
.mutuo-risultato-sub { font-size: 10px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.mutuo-importo-val { color: var(--blue); font-weight: 700; font-size: 13px; }
.mutuo-box .cta-secondary-btn { margin-top: 14px; }
.mutuo-disclaimer { font-size: 10px; color: var(--muted); line-height: 1.4; margin-top: 8px; text-align: center; }

/* Consulente */
.consultant-box {
  background: var(--blue-ultra); border-radius: 14px; padding: 16px 18px;
  border: 1px solid var(--border);
}
.cb-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 12px; }
.cb-body { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cb-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--blue); color: white; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cb-name { font-size: 14px; font-weight: 700; }
.cb-role { font-size: 11px; color: var(--muted); }
.cb-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cb-stat { background: white; border-radius: 8px; padding: 8px; text-align: center; }
.cb-stat-n { font-size: 16px; font-weight: 700; color: var(--blue); }
.cb-stat-l { font-size: 9px; color: var(--muted); }
.cb-codice { font-size: 11px; color: var(--muted); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); text-align: center; }
.cb-codice strong { color: var(--dark, #0D1B2A); }

/* ─── DATI PROCEDURA ──────────────────────────────────────── */
.proc-box {
  background: white; border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 18px;
}
.proc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: .5px solid rgba(2,115,252,.08);
}
.proc-row:last-child { border-bottom: none; }
.proc-row.highlight { background: var(--blue-ultra); margin: -2px -4px 2px; padding: 10px 4px; border-radius: 8px; border-bottom: none; }
.proc-lbl { font-size: 12px; color: var(--muted); }
.proc-val { font-size: 12px; font-weight: 600; text-align: right; }
.proc-code {
  font-family: 'DM Mono', monospace; font-size: 11px;
  background: white; color: var(--blue); font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--blue-light); letter-spacing: .3px;
}
.proc-date-val { color: var(--blue); }


/* ─── FRECCE NAVIGAZIONE ──────────────────────────────────── */
.gallery-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.92); border: none;
  font-size: 28px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue); box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  transition: background .15s, transform .15s;
  padding: 0;
}
.gallery-arrow:hover { background: white; transform: translateY(-50%) scale(1.08); }
.arrow-prev { left: 16px; }
.arrow-next { right: 16px; }

.gallery-counter {
  position: absolute; bottom: 14px; left: 16px; z-index: 2;
  background: rgba(0,0,0,0.55); color: white;
  font-size: 12px; font-weight: 600; padding: 4px 12px;
  border-radius: 8px; backdrop-filter: blur(4px);
}

/* Transizione immagine principale */
#mainImg { transition: opacity .15s ease; }

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .detail-body { grid-template-columns: 1fr; padding: 0 16px; }
  .detail-left { padding: 20px 0; border-right: none; border-bottom: 1px solid var(--border); }
  .detail-sidebar { padding: 20px 0; }
  .key-stats { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr; }
  .gallery { width: calc(100% - 32px); margin-top: 12px; border-radius: 12px; }
  .breadcrumb-bar { padding: 10px 16px; }
  .map-placeholder { height: 180px; }
}

/* ─── OVERLAY LOGIN GALLERIA ──────────────────────────────── */
.gallery-login-overlay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(2,29,80,0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.glo-box {
  background: white; border-radius: 16px; padding: 32px 28px;
  text-align: center; max-width: 300px; width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,.25);
}
.glo-icon  { font-size: 40px; margin-bottom: 12px; }
.glo-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.glo-sub   { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.5; }
.glo-btn   {
  display: block; background: var(--blue); color: white;
  font-weight: 700; padding: 12px 24px; border-radius: 24px;
  font-size: 14px; margin-bottom: 10px; text-decoration: none;
  transition: transform .15s;
}
.glo-btn:hover { transform: translateY(-1px); }
.glo-link  { font-size: 12px; color: var(--blue); text-decoration: none; }

/* Thumbnail bloccata */
.thumb-locked { position: relative; cursor: pointer; }
.thumb-lock-overlay {
  position: absolute; inset: 0;
  background: rgba(2,29,80,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; border-radius: 4px;
}

/* Blocca right-click su immagini */
.gallery-main img { -webkit-user-drag: none; user-select: none; }

/* ─── LIGHTBOX FOTO A SCHERMO INTERO ─────────────────────────── */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(230,242,255,.35);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease;
}
.lightbox-overlay.open { opacity: 1; visibility: visible; }
.lightbox-overlay img {
  max-width: 92vw; max-height: 88vh;
  object-fit: contain; border-radius: 4px;
  -webkit-user-drag: none; user-select: none;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.lightbox-close {
  position: absolute; top: 20px; right: 28px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--blue-dark); font-size: 28px; line-height: 1;
  cursor: pointer; transition: background .15s, transform .15s;
  box-shadow: 0 4px 16px rgba(2,29,80,.12);
}
.lightbox-close:hover { background: rgba(255,255,255,.8); transform: scale(1.06); }
.lightbox-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.6);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--blue-dark); font-size: 30px; line-height: 1;
  cursor: pointer; transition: background .15s, transform .15s;
  box-shadow: 0 4px 16px rgba(2,29,80,.12);
}
.lightbox-arrow:hover { background: rgba(255,255,255,.8); transform: translateY(-50%) scale(1.08); }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-counter {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,.55); color: var(--blue-dark);
  border: 1px solid rgba(255,255,255,.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 20px;
  box-shadow: 0 4px 16px rgba(2,29,80,.12);
}
@media (max-width: 640px) {
  .lightbox-arrow { width: 40px; height: 40px; font-size: 24px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 22px; }
}

/* Documenti — link visualizza e lock */
.doc-dl        { font-size: 12px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.doc-lock-link {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
  text-decoration: none; transition: color .15s;
}
.doc-lock-link:hover { color: var(--blue); }
