/* ==========================================================
   Styles των Svelte components (χάρτες, gallery, φόρμες).
   Χρώματα από μεταβλητές (--ml-primary, --ml-ink, --ml-line, --ml-sand, --ml-muted),
   ώστε να ταιριάζουν σε όποιο design τα ορίζει
   ========================================================== */
.gallery-main { border-radius: 1rem; overflow: hidden; aspect-ratio: 16/10; background: var(--ml-sand); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: .5rem; cursor: pointer;
  opacity: .7; border: 2px solid transparent; transition: all .15s;
}
.gallery-thumbs img:hover, .gallery-thumbs img.active { opacity: 1; border-color: var(--ml-primary); }

listings-map, .listings-map-canvas { display: block; width: 100%; height: 100%; }
.listings-map-canvas { background: var(--ml-sand); z-index: 0; }
.listings-map-status {
  position: absolute; top: .75rem; left: 50%; transform: translateX(-50%); z-index: 500;
  background: #fff; border-radius: 999px; padding: .35rem .9rem; font-size: .85rem; box-shadow: 0 4px 14px rgba(31,35,40,.15);
  white-space: nowrap; pointer-events: none;
}

/* πινέζες: ετικέτα τιμής, με διακεκομμένο περίγραμμα όταν η θέση είναι κατά προσέγγιση */
.map-pin-icon { background: none; border: 0; }
.map-pin {
  position: relative; transform: translate(-50%, calc(-100% - 6px));
  background: #fff; color: var(--ml-ink); border: 2px solid var(--ml-primary); border-radius: 999px;
  padding: .1rem .5rem; font-size: .78rem; font-weight: 700; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: background .15s, color .15s;
}
.map-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ml-primary); border-bottom: 0;
}
.map-pin.approx { border-style: dashed; }
.map-pin:hover, .map-pin.active { background: var(--ml-primary); color: #fff; }
/* .leaflet-container: το CSS του markercluster φορτώνει μετά από αυτό το αρχείο */
.leaflet-container .marker-cluster { background-color: color-mix(in srgb, var(--ml-primary) 25%, transparent); }
.leaflet-container .marker-cluster div { background-color: var(--ml-primary); color: #fff; font-weight: 700; font-family: inherit; }

.map-popup-wrapper .leaflet-popup-content { margin: 0; }
.map-popup-wrapper .leaflet-popup-content-wrapper { padding: 0; overflow: hidden; border-radius: .75rem; }
.leaflet-container a.map-popup { display: block; color: var(--ml-ink); text-decoration: none; }
.map-popup img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.map-popup .fw-semibold { color: var(--ml-primary); }
.map-popup-title { font-size: .85rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Σελίδα ακινήτου ---------- */
property-gallery .gallery-main { position: relative; }
.gallery-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--ml-ink);
  display: grid; place-items: center; font-size: 1.2rem; box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.gallery-nav.prev { left: .75rem; }
.gallery-nav.next { right: .75rem; }
.gallery-counter {
  position: absolute; right: .75rem; bottom: .75rem; z-index: 2;
  background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; padding: .2rem .7rem; font-size: .85rem;
}
property-gallery .gallery-thumbs { display: flex; gap: .5rem; overflow-x: auto; padding: .5rem 0 .25rem; scrollbar-width: thin; }
property-gallery .gallery-thumbs button { flex: 0 0 96px; padding: 0; border: 0; background: none; }
property-gallery .gallery-thumbs img { width: 96px; height: 72px; }
property-gallery .gallery-thumbs button.active img { opacity: 1; border-color: var(--ml-primary); }

.gallery-lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(10,12,14,.95); display: grid; place-items: center; }
.gallery-lightbox img { max-width: 94vw; max-height: 88vh; object-fit: contain; }
.gallery-lightbox .gallery-close {
  position: absolute; top: 1rem; right: 1rem; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.15); color: #fff; font-size: 1.2rem;
}
.gallery-lightbox .gallery-counter { left: 50%; right: auto; transform: translateX(-50%); bottom: 1rem; }

.property-text { white-space: normal; line-height: 1.7; }
.property-map-canvas { height: 340px; border-radius: 1rem; border: 1px solid var(--ml-line); z-index: 0; }
property-map .map-pin { font-size: 1rem; padding: .2rem .55rem; }

/* κρυφό πεδίο κατά των bots: εκτός οθόνης αντί για display:none, που κάποια bots το αναγνωρίζουν */
.sf-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Επιλογή πολλών από δέντρο: κατηγορίες, περιοχές (TreePicker) ---------- */
/* το πεδίο έχει την εμφάνιση του select (.form-select) και μέσα τα tags των επιλεγμένων */
.tree-field { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-height: 38px; cursor: pointer; text-align: left; }
.tree-field:focus { border-color: var(--ml-primary); outline: 0; box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--ml-primary) 15%, transparent); }
.tree-placeholder { color: var(--ml-ink); }
.tree-tag {
  display: inline-flex; align-items: center; gap: .3rem; max-width: 100%;
  padding: .15rem .25rem .15rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600; line-height: 1.4;
  background: color-mix(in srgb, var(--ml-primary) 10%, #fff); color: var(--ml-primary);
}
.tree-tag button {
  width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font-size: 1rem; line-height: 1;
}
.tree-tag button:hover { background: var(--ml-primary); color: #fff; }

/* popup: πάνω από το συρτάρι των φίλτρων (offcanvas, z-index 1045) */
.tree-modal { position: fixed; inset: 0; z-index: 2050; display: grid; place-items: center; padding: 1rem; background: rgba(15,20,25,.55); }
.tree-dialog {
  display: flex; flex-direction: column; width: 100%; max-width: 680px; max-height: calc(100vh - 2rem);
  background: #fff; border-radius: 1rem; box-shadow: 0 30px 80px rgba(0,0,0,.25); color: var(--ml-ink);
}
.tree-dialog-head, .tree-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.5rem; }
.tree-dialog-head { border-bottom: 1px solid var(--ml-line); }
.tree-dialog-head h5 { margin: 0; font-weight: 700; }
.tree-dialog-foot { border-top: 1px solid var(--ml-line); }
.tree-search { position: relative; padding: 1rem 1.5rem 0; }
.tree-search .bi { position: absolute; left: 2.35rem; top: 50%; transform: translateY(calc(-50% + .5rem)); color: var(--ml-muted); }
.tree-search .form-control { padding-left: 2.4rem; border-radius: .6rem; }
/* min-height: 0: η λίστα μαζεύει στο ύψος του popup αντί να το ξεχειλίζει */
.tree-dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .5rem 1.5rem 1rem; }
.tree-group { padding: .9rem 0; border-bottom: 1px solid var(--ml-line); }
.tree-group:last-child { border-bottom: 0; }
.tree-rows.columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .1rem 1.5rem; }
.tree-option { display: flex; align-items: center; gap: .55rem; padding: .35rem 0; cursor: pointer; margin: 0; }
.tree-option .form-check-input { margin: 0; flex-shrink: 0; }
.tree-option .form-check-input:checked { background-color: var(--ml-primary); border-color: var(--ml-primary); }
.tree-option span { flex: 1; }
.tree-option small { color: var(--ml-muted); font-size: .8rem; }
.tree-option.main { font-weight: 700; }
.tree-option.disabled { opacity: .55; cursor: default; }
.tree-match { padding: .35rem 0; border-bottom: 1px solid var(--ml-line); }
.tree-match .tree-option { padding: 0; }
.tree-path { padding-left: 1.6rem; font-size: .78rem; color: var(--ml-muted); }
