/* ==========================================================
   Scheda immobile - si carica DOPO home.css e ne usa le variabili
   (header, footer, colori e font arrivano da home.css)
   ========================================================== */
:root {
    --text-soft: #5c6375;
    --border: #e3e6ee;
    --radius: 12px;
    --shadow: 0 2px 10px rgba(16, 24, 64, .06);
}

.scheda { padding-top: 20px; padding-bottom: 40px; }
.scheda img { max-width: 100%; display: block; }
.scheda h1, .scheda h2 { line-height: 1.25; }

/* ---------- Avvisi ---------- */
.alert { margin-top: 20px; padding: 14px 18px; border-radius: 8px; font-weight: bold; }
.alert i { margin-right: 6px; }
.alert-success { background: #e3f6e8; color: #145c2c; border: 1px solid #b9e4c6; }
.alert-error { background: #fde8ea; color: #8a1424; border: 1px solid #f6c3c9; }
.alert-info { background: #e7e9f7; color: var(--primary-color); border: 1px solid #c9cdf0; }
.alert a { text-decoration: underline; }

/* ---------- Barra superiore ---------- */
.top-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 20px 0 14px;
}
.back-link { font-weight: bold; color: var(--text-soft); }
.back-link i { margin-right: 4px; }
.share { display: flex; align-items: center; gap: 8px; }
.share-label { font-size: .85em; color: var(--text-soft); }
.share-btn {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 0; cursor: pointer;
    color: #fff; font-size: 1.05em;
    transition: transform var(--transition-speed), background-color var(--transition-speed);
}
.share-btn:hover { color: #fff; transform: translateY(-2px); }
.share-wa { background: #25D366; }
.share-fb { background: #1877F2; }
.share-mail { background: #6b7280; }
.share-copy { background: var(--primary-color); }
.share-copy.copied { background: #16a34a; }

/* ---------- Titolo e prezzo ---------- */
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge {
    font-size: .75em; font-weight: bold; letter-spacing: .05em; text-transform: uppercase;
    padding: 4px 10px; border-radius: 999px;
    background: #e7e9f7; color: var(--primary-color);
}
/* stessi colori delle etichette nelle card della home */
.badge-venduto    { background: #A00000; color: #fff; }
.badge-trattativa { background: var(--primary-color); color: #fff; }
.badge-nuovo      { background: #008000; color: #fff; }
.badge-riservata  { background: #4B0082; color: #fff; }
.intro h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); color: var(--primary-color); }
.indirizzo { margin-top: 6px; color: #666; }
.indirizzo i { color: var(--secondary-color); margin-right: 4px; }
.intro-prezzo { text-align: right; flex-shrink: 0; }
.prezzo { font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: bold; color: #c4041c; white-space: nowrap; }
.prezzo small { font-size: .5em; font-weight: normal; color: #555; }
.rif { font-size: .85em; color: var(--text-soft); }

/* ---------- Galleria ---------- */
.gallery { margin-bottom: 16px; }
.gallery-main {
    position: relative; aspect-ratio: 16 / 9;
    background: #11152a; border-radius: var(--radius); overflow: hidden;
}
.gallery-slide {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0; transition: opacity .35s; cursor: zoom-in;
}
.gallery-slide.is-active { opacity: 1; z-index: 1; }
.gallery-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 46px; height: 46px; border-radius: 50%; border: 0;
    background: rgba(255, 255, 255, .92); color: var(--primary-color);
    font-size: 1.1em; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.gallery-arrow:hover { background: #fff; }
.gallery-arrow.prev { left: 14px; }
.gallery-arrow.next { right: 14px; }
.gallery-counter, .gallery-zoom {
    position: absolute; bottom: 14px; z-index: 2;
    background: rgba(0, 0, 0, .6); color: #fff;
    font-size: .85em; padding: 5px 12px; border-radius: 999px; border: 0;
}
.gallery-counter { left: 14px; }
.gallery-zoom { right: 14px; cursor: pointer; font-family: inherit; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumb {
    flex: 0 0 110px; height: 74px; padding: 0;
    border: 3px solid transparent; border-radius: 8px; overflow: hidden;
    cursor: pointer; opacity: .6; background: none;
    transition: opacity var(--transition-speed), border-color var(--transition-speed);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { opacity: 1; }
.thumb.is-active { opacity: 1; border-color: var(--secondary-color); }
.gallery-empty {
    padding: 60px 20px; margin-bottom: 16px; text-align: center;
    background: #fff; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--text-soft);
}

/* ---------- Navigazione rapida ---------- */
.quick-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
    font-weight: bold; font-size: .9em; padding: 8px 16px; border-radius: 999px;
    background: #fff; border: 1px solid var(--border); color: var(--text-dark);
}
.chip i { color: var(--secondary-color); margin-right: 4px; }
.chip:hover { border-color: var(--primary-color); color: var(--primary-color); }
.chip-accent, .chip-accent i { background: var(--secondary-color); border-color: var(--secondary-color); color: #fff; }
.chip-accent:hover { background: #c4041c; color: #fff; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 20px; }
.col-side { position: sticky; top: 16px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card h2 {
    font-size: 1.2em; color: var(--primary-color);
    margin-bottom: 14px; padding-left: 12px; border-left: 4px solid var(--secondary-color);
}
.muted { color: var(--text-soft); margin: -6px 0 14px; font-size: .95em; }

.key-facts { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.key-facts li {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.key-facts i { color: var(--secondary-color); font-size: 1.2em; }
.key-facts strong { display: block; font-size: 1.35em; color: var(--primary-color); margin-top: 4px; }
.key-facts span { font-size: .85em; color: var(--text-soft); }

.descrizione { white-space: pre-line; }

.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.details div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.details dt { color: var(--text-soft); }
.details dd { font-weight: bold; text-align: right; }

.features { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.features i { color: var(--primary-color); margin-right: 6px; }

/* Classe energetica */
.energy-scale { display: flex; gap: 4px; }
.energy-bar {
    flex: 1; text-align: center; padding: 8px 0;
    font-weight: bold; font-size: .85em; color: #fff;
    border-radius: 6px; opacity: .35;
}
.energy-bar.active { opacity: 1; transform: scaleY(1.25); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--text-dark); }
.class-A4 { background: #006837; }
.class-A3 { background: #00843d; }
.class-A2 { background: #1a9641; }
.class-A1, .class-A { background: #4caf50; }
.class-B  { background: #8bc34a; }
.class-C  { background: #cddc39; color: var(--text-dark); }
.class-D  { background: #ffeb3b; color: var(--text-dark); }
.class-E  { background: #ffc107; color: var(--text-dark); }
.class-F  { background: #ff7f00; }
.class-G  { background: #e31a1c; }
.energy-label { margin-top: 18px; color: var(--text-soft); }
.energy-label strong { color: var(--text-dark); }

/* Iframe (virtual tour, mappa) */
.embed { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg-light); }
.embed-map { aspect-ratio: 16 / 8; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Planimetrie */
.planimetrie { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.planimetrie-1 { grid-template-columns: 1fr; }
.planimetrie a { display: block; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; cursor: zoom-in; }
.planimetrie img { width: 100%; max-height: 520px; object-fit: contain; margin: 0 auto; }

/* ---------- Contatti ---------- */
.contact-card { padding: 22px; }
.agent { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.agent-avatar {
    width: 54px; height: 54px; flex-shrink: 0; border-radius: 50%;
    background: var(--primary-color); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4em; font-weight: bold;
}
.agent-foto {
    width: 72px; height: 72px; object-fit: cover; object-position: center 20%;   /* inquadra il viso */
    background: #e8eaf0; border: 3px solid #fff; box-shadow: 0 2px 10px rgba(16, 24, 64, .18);
}
.agent-name { font-weight: bold; font-size: 1.1em; color: var(--primary-color); }
.agent-office { color: var(--text-soft); font-size: .9em; }
.contact-card .form-title { margin: 22px 0 14px; }

.contact-form { display: flex; flex-direction: column; gap: 12px; }
.contact-form label { display: flex; flex-direction: column; gap: 4px; font-size: .85em; font-weight: bold; color: var(--text-soft); }
.contact-form input[type=text], .contact-form input[type=email],
.contact-form input[type=tel], .contact-form textarea {
    width: 100%; min-width: 0;
    font: inherit; font-weight: normal; color: var(--text-dark);
    padding: 10px 12px; border: 1px solid #ddd; border-radius: 4px; background: #fafbfd;
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(4, 15, 159, .15); background: #fff;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-form .check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: normal; font-size: .82em; }
.check input { margin-top: 3px; accent-color: var(--primary-color); }
.contact-form select, .contact-form input[type=date] {
    width: 100%; min-width: 0; font: inherit; font-weight: normal; color: var(--text-dark);
    padding: 9px 10px; border: 1px solid #ddd; border-radius: 4px; background: #fafbfd;
}
.check-visita { padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; background: #f6f7fc; }
.check-visita span { color: var(--primary-color); font-size: 1.1em; }
.check-visita .ico { color: var(--secondary-color); margin-right: 2px; }
.visita-campi[hidden] { display: none; }

/* Rata del mutuo */
.rata-link { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 2px; font-size: .9em; color: var(--primary-color); }
.rata-link span { text-decoration: underline; text-underline-offset: 3px; }
.rata-link .ico { color: var(--secondary-color); }
.mutuo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mutuo label { display: flex; flex-direction: column; gap: 4px; font-size: .85em; font-weight: bold; color: var(--text-soft); }
.mutuo-in { display: flex; align-items: center; gap: 4px; padding: 0 10px; border: 1px solid #ddd; border-radius: 4px; background: #fafbfd; color: var(--text-dark); font-weight: normal; }
.mutuo-in:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(4, 15, 159, .15); background: #fff; }
.mutuo-in input, .mutuo-in select { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; font: inherit; padding: 9px 0; outline: none; }
.mutuo-esito { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius); background: #f1f3fb; text-align: center; }
.mutuo-esito p:first-child { color: var(--text-soft); font-size: .9em; }
.mutuo-rata { font-size: 2em; font-weight: bold; color: var(--primary-color); line-height: 1.2; }
.mutuo-det { color: var(--text-soft); font-size: .88em; }
.mutuo-nota { margin-top: 12px; font-size: .82em; color: var(--text-soft); }
.mutuo-nota a { color: var(--primary-color); text-decoration: underline; }

/* Immobili simili */
.simili { margin-top: 40px; }
.simili h2 { font-size: 1.4em; color: var(--primary-color); margin-bottom: 16px; padding-left: 12px; border-left: 4px solid var(--secondary-color); }

/* Bottoni */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: bold; padding: 13px 20px;
    border: 0; border-radius: var(--border-radius); cursor: pointer;
    transition: background-color var(--transition-speed);
}
.btn-block { width: 100%; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover { background: #003366; color: #fff; }
.btn-accent { background: var(--secondary-color); color: #fff; }
.btn-accent:hover { background: #c4041c; color: #fff; }

/* ---------- Barra fissa mobile ---------- */
.mobile-bar { display: none; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(8, 10, 20, .95); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
.lb-close, .lb-arrow {
    position: absolute; width: 50px; height: 50px; border-radius: 50%; border: 0;
    background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.3em; cursor: pointer;
}
.lb-close { top: 16px; right: 16px; }
.lb-arrow { top: 50%; transform: translateY(-50%); }
.lb-arrow.prev { left: 16px; }
.lb-arrow.next { right: 16px; }
.lightbox.single .lb-arrow { display: none; }
.lb-counter { position: absolute; bottom: 18px; color: #fff; font-size: .9em; }

/* ---------- Pagina di errore ---------- */
.errore-pagina { text-align: center; padding: 12vh 20px; }
.errore-pagina h1 { color: var(--primary-color); margin-bottom: 24px; }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 992px) {
    .layout { grid-template-columns: 1fr; }
    .col-side { position: static; }
}

@media (max-width: 600px) {
    .intro { flex-direction: column; align-items: flex-start; gap: 8px; }
    .intro-prezzo { text-align: left; }
    .share-label { display: none; }

    .gallery-main { aspect-ratio: 4 / 3; margin: 0 -20px; border-radius: 0; }
    .gallery-arrow { width: 38px; height: 38px; }
    .gallery-zoom { display: none; }
    .thumb { flex-basis: 80px; height: 56px; }

    .card { padding: 18px; }
    .details, .row-2 { grid-template-columns: 1fr; }
    .mutuo { grid-template-columns: 1fr 1fr; }
    .energy-bar { font-size: .7em; }

    body { padding-bottom: 72px; }
    .mobile-bar {
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;   /* 2 o 3 pulsanti sulla stessa riga */
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: #fff; box-shadow: 0 -4px 16px rgba(0, 0, 0, .1);
    }
}

@media (max-width: 360px) {
    .g-recaptcha { transform: scale(.88); transform-origin: left top; }
}

/* WhatsApp e orari nel riquadro contatti */
.btn-wa { background: #0F7A6E; color: #fff; margin-top: 10px; }
.btn-wa:hover { background: #0e6f64; color: #fff; }
.contact-card .h-orari-box { margin: 14px 0 0; }
.mobile-bar .btn-wa { margin-top: 0; }
.mobile-bar .btn { padding-left: 6px; padding-right: 6px; white-space: nowrap; }

/* Prezzo ribassato e "Avvisami" */
.prezzo-prima { font-size: .95em; color: var(--text-soft); white-space: nowrap; }
.prezzo-prima span { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #008000; color: #fff; font-weight: bold; font-size: .85em; }
.cerco-scheda { margin-top: 40px; }
