/* =========================================================================
   EasyREMS — Frontend / Archivio  ·  Design premium editoriale
   Angoli netti, palette sobria, tipografia curata. Namespace .erms
   ========================================================================= */

.erms {
	--ink:   #14181f;   /* quasi nero */
	--sub:   #737a84;   /* grigio testo */
	--line:  #e7e7e4;   /* hairline */
	--soft:  #f6f6f3;   /* off-white sezioni */
	--paper: #ffffff;
	--accent:#1b2b46;   /* navy profondo, unico "colore" */
	--accent-2:#2c4772;
	--maxw: 1280px;

	color: var(--ink);
	background: var(--paper);
	-webkit-font-smoothing: antialiased;
	font-feature-settings: "kern" 1, "liga" 1;
}
.erms *, .erms *::before, .erms *::after { box-sizing: border-box; }
.erms img { max-width: 100%; }
/* Reset heading: il tema gonfia h1/h2 — qui le dimensioni le decidono le classi */
.erms h1, .erms h2, .erms h3, .erms h4, .erms h5 { margin: 0; padding: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.erms-container { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

/* ---------- Intestazione archivio ---------- */
.erms-archive { padding: 56px 0 96px; }
.erms-archive__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 22px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.erms-archive__title { font-size: 1.5rem !important; font-weight: 600; letter-spacing: -.01em; margin: 0; line-height: 1.15; }
.erms-archive__count { margin: 0; color: var(--sub); font-size: .95rem; letter-spacing: .01em; }
.erms-archive__count strong { color: var(--ink); font-weight: 600; }

/* ---------- Filtri (barra minimale, underline) ---------- */
.erms-filters { margin-bottom: 40px; }
.erms-filters__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 22px 26px; align-items: end; }
.erms-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.erms-field > span { font-size: .68rem; font-weight: 600; color: var(--sub); text-transform: uppercase; letter-spacing: .14em; }
.erms-field select, .erms-field input {
	width: 100%; height: 40px; padding: 0 2px; border: 0; border-bottom: 1px solid #cfcfca;
	background: transparent; color: var(--ink); font-size: .98rem; border-radius: 0;
	transition: border-color .2s;
	appearance: none; -webkit-appearance: none;
}
.erms-field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2314181f' stroke-width='1.4' d='M1 1.5 6 6l5-4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; padding-right: 20px; }
.erms-field select:focus, .erms-field input:focus { outline: none; border-bottom-color: var(--ink); }
.erms-field--actions { flex-direction: row; gap: 10px; align-items: center; }

.erms-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px;
	height: 38px; padding: 0 18px; border-radius: 0; font-weight: 600; font-size: .73rem;
	letter-spacing: .08em; text-transform: uppercase; text-decoration: none; cursor: pointer;
	border: 1px solid var(--ink); background: var(--ink); color: #fff; white-space: nowrap;
	transition: background .2s, color .2s, border-color .2s;
}
.erms-btn:hover { background: transparent; color: var(--ink); }
.erms-btn--ghost { background: transparent; color: var(--ink); }
.erms-btn--ghost:hover { background: var(--ink); color: #fff; }
.erms-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.erms-btn--primary:hover { background: transparent; color: var(--accent); }

.erms-toolbar { display: flex; justify-content: flex-end; margin-top: 18px; }
.erms-toolbar__sort { display: flex; gap: 26px; flex-wrap: wrap; }
.erms-toolbar__sort label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--sub); display: inline-flex; align-items: center; gap: 10px; }
.erms-toolbar__sort select { border: 0; border-bottom: 1px solid #cfcfca; background: transparent; height: 30px; font-size: .85rem; color: var(--ink); border-radius: 0; }

/* ---------- Griglia ---------- */
.erms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 48px 34px; }

/* ---------- Card (editoriale, angoli netti) ---------- */
.erms-card { background: transparent; display: flex; flex-direction: column; }
.erms-card__media { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--soft); }
.erms-card__img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.erms-card:hover .erms-card__img { transform: scale(1.05); }
.erms-card__noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--sub); font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }

/* etichetta discreta al posto del badge */
.erms-card__eyebrow { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font-size: .68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--sub); }
.erms-card__eyebrow .dot { width: 4px; height: 4px; background: var(--sub); border-radius: 50%; }
.erms-card__eyebrow .evid { color: var(--accent); }

.erms-card__price { font-size: 1.4rem; font-weight: 600; letter-spacing: -.015em; margin: 8px 0 0; }
.erms-card__title { font-size: 1.02rem !important; font-weight: 500; line-height: 1.35; margin: 6px 0 0; }
.erms-card__title a { color: var(--ink); text-decoration: none; background-image: linear-gradient(var(--ink),var(--ink)); background-size: 0% 1px; background-repeat: no-repeat; background-position: left bottom; transition: background-size .3s; }
.erms-card:hover .erms-card__title a { background-size: 100% 1px; }
.erms-card__loc { margin: 6px 0 0; color: var(--sub); font-size: .92rem; }
.erms-card__specs { list-style: none; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 18px; }
.erms-spec { font-size: .86rem; color: var(--ink); letter-spacing: .01em; }
.erms-spec span { color: var(--sub); }
.erms-card__foot { margin-top: 10px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); }

/* ---------- Paginazione ---------- */
.erms-pagination { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 64px 0 0; }
.erms-page { min-width: 44px; height: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; color: var(--ink); text-decoration: none; font-size: .9rem; transition: border-color .2s; border-radius: 0; }
.erms-page:hover { border-color: var(--line); }
.erms-page.is-current { border-color: var(--ink); font-weight: 600; }
.erms-page--dots { border: 0; }
.erms-page--prev, .erms-page--next { text-transform: uppercase; letter-spacing: .1em; font-size: .74rem; }

/* ---------- Vuoto ---------- */
.erms-empty { text-align: center; padding: 90px 20px; color: var(--sub); }
.erms-empty p { margin-bottom: 22px; font-size: 1.05rem; }

/* ---------- Widget Elementor ---------- */
.erms--widget { padding: 10px 0; }
.erms-widget__title { font-size: 1.4rem !important; font-weight: 600; letter-spacing: -.01em; margin: 0 0 28px; }
.erms-widget__more { margin-top: 40px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
	.erms-container { padding: 0 20px; }
	.erms-archive { padding: 36px 0 64px; }
	.erms-grid { grid-template-columns: 1fr; gap: 40px; }
	.erms-filters__row { grid-template-columns: repeat(2, 1fr); }
	.erms-field--actions { grid-column: 1 / -1; }
	.erms-toolbar { justify-content: flex-start; }
}

/* =========================================================================
   Archivio premium — searchbar, viste, lista, mappa, modale
   ========================================================================= */
.erms-search { margin-bottom: 4px; }
.erms-search__base { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.erms-field2 { display: flex; flex-direction: column; gap: 8px; flex: 1 1 165px; min-width: 0; }
.erms-field2--num { flex: 0 1 140px; }
.erms-field2__lbl { font-size: .64rem; text-transform: uppercase; letter-spacing: .14em; color: var(--sub); font-weight: 600; }
.erms-field2 select, .erms-field2 input { width: 100%; height: 48px; border: 1px solid #dcdcd7; background: #fff; border-radius: 2px; padding: 0 14px; font-size: .95rem; color: var(--ink); appearance: none; -webkit-appearance: none; transition: border-color .18s, box-shadow .18s; }
.erms-field2 select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2314181f' stroke-width='1.3' d='M1 1.5 6 6l5-4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; cursor: pointer; }
.erms-field2 select:hover, .erms-field2 input:hover { border-color: #a9a69c; }
.erms-field2 select:focus, .erms-field2 input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.erms-search__actions { display: flex; gap: 10px; align-items: center; height: 48px; flex: 0 0 auto; }
.erms-advbtn { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px; background: #fff; border: 1px solid #dcdcd7; color: var(--ink); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; cursor: pointer; transition: border-color .18s; }
.erms-advbtn:hover { border-color: var(--ink); }
.erms-advdot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }

.erms-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 32px; flex-wrap: wrap; }
.erms-views { display: inline-flex; border: 1px solid var(--line); }
.erms-viewbtn { width: 40px; height: 34px; display: inline-flex; align-items: center; justify-content: center; color: var(--sub); text-decoration: none; font-size: .95rem; line-height: 1; border-right: 1px solid var(--line); transition: background .15s, color .15s; }
.erms-viewbtn:last-child { border-right: 0; }
.erms-viewbtn:hover { color: var(--ink); }
.erms-viewbtn.is-active { background: var(--ink); color: #fff; }
.erms-sort { display: inline-flex; align-items: center; gap: 10px; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--sub); }
.erms-sort select { border: 0; border-bottom: 1px solid #cfcfca; background: transparent; height: 32px; font-size: .82rem; color: var(--ink); border-radius: 0; }
.erms-sort select:focus { outline: none; border-bottom-color: var(--ink); }

.erms-list { display: flex; flex-direction: column; }
.erms-row { display: grid; grid-template-columns: 260px 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.erms-row:first-child { border-top: 1px solid var(--line); }
.erms-row__media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--soft); }
.erms-row__img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1); }
.erms-row:hover .erms-row__img { transform: scale(1.05); }
.erms-row__noimg { display: block; width: 100%; height: 100%; background: var(--soft); }
.erms-row__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.erms-row__eyebrow { display: flex; align-items: center; gap: 8px; font-size: .64rem; text-transform: uppercase; letter-spacing: .14em; color: var(--sub); }
.erms-row__eyebrow .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--sub); }
.erms-row__title { font-size: 1.08rem !important; font-weight: 600; margin: 2px 0; }
.erms-row__title a { color: var(--ink); text-decoration: none; }
.erms-row__title a:hover { color: var(--accent); }
.erms-row__loc { color: var(--sub); font-size: .9rem; }
.erms-row__specs { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; padding: 8px 0 0; margin: 0; font-size: .86rem; color: var(--ink); }
.erms-row__foot { margin-top: auto; padding-top: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.erms-row__price { font-size: 1.18rem; font-weight: 600; }
.erms-row__code { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--sub); }

/* In vista mappa tutto va full-width (header, filtri, mappa) */
.erms-view-map .erms-container { max-width: none; padding-left: 28px; padding-right: 28px; }
.erms-view-map .erms-archive { padding-bottom: 0; }
.erms-maplayout { display: grid; grid-template-columns: 440px 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); height: calc(100vh - 170px); min-height: 540px; width: 100vw; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; }
.erms-maplist { overflow-y: auto; border-right: 1px solid var(--line); }
.erms-maplist .erms-row { grid-template-columns: 116px 1fr; gap: 14px; padding: 14px 16px; cursor: pointer; border-top: 0; }
.erms-maplist .erms-row:first-child { border-top: 0; }
.erms-maplist .erms-row { position: relative; cursor: pointer; }
.erms-maplist .erms-row.is-active { background: var(--soft); }
.erms-row__locate { display: none; }
.erms-maplist .erms-row__locate { display: flex; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 50%; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s, color .15s; box-shadow: 0 3px 10px rgba(0,0,0,.14); padding: 0; }
.erms-maplist .erms-row:hover .erms-row__locate, .erms-maplist .erms-row.is-active .erms-row__locate { opacity: 1; }
.erms-maplist .erms-row__locate:hover { background: var(--ink); color: #fff; }
.erms-maplist .erms-row__title { font-size: .95rem !important; }
.erms-maplist .erms-row__specs { display: none; }
.erms-mapcanvas { position: relative; }
.erms-searchmap { position: absolute; inset: 0; z-index: 0; }
.erms-searchmap .leaflet-marker-icon.erms-pin { background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 700; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); border-radius: 0; width: auto !important; height: auto !important; padding: 4px 8px; white-space: nowrap; }
.erms-searchmap .leaflet-marker-icon.erms-pin.is-active { background: var(--accent); }

.erms-modal { position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(20,24,31,.5); }
.erms-modal.is-open { display: flex; }
.erms-modal__panel { background: #fff; width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.erms-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.erms-modal__head h2 { font-size: .82rem !important; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; margin: 0; }
.erms-modal__x { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--sub); cursor: pointer; }
.erms-modal__x:hover { color: var(--ink); }
.erms-modal__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; padding: 26px; }
.erms-modal__grid .erms-f { display: flex; flex-direction: column; gap: 7px; }
.erms-modal__grid .erms-f span { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--sub); font-weight: 600; }
.erms-modal__grid select, .erms-modal__grid input { height: 38px; border: 0; border-bottom: 1px solid #cfcfca; background: transparent; font-size: .9rem; border-radius: 0; padding: 0 2px; }
.erms-modal__grid select:focus, .erms-modal__grid input:focus { outline: none; border-bottom-color: var(--ink); }
.erms-modal__foot { display: flex; justify-content: space-between; gap: 12px; padding: 20px 26px; border-top: 1px solid var(--line); }

/* Mappa full-screen */
.erms-mapfs { position: fixed; inset: 0; z-index: 99999; background: #fff; display: flex; flex-direction: column; }
.erms-mapfs__bar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); height: 62px; flex: 0 0 auto; }
.erms-mapfs__logo { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; display: inline-flex; align-items: center; }
.erms-mapfs__logo img { max-height: 38px; width: auto; display: block; }
.erms-mapfs__views { display: flex; gap: 8px; }
.erms-mapfs__views a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--ink); color: var(--ink); text-decoration: none; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; transition: background .15s, color .15s; }
.erms-mapfs__views a:hover { background: var(--ink); color: #fff; }
.erms-mapfs .erms-maplayout { width: auto; margin: 0; left: auto; right: auto; height: auto; min-height: 0; flex: 1; border: 0; border-top: 0; }

@media (max-width: 860px) {
	.erms-mapfs__views a span { display: none; }
	.erms-maplayout { grid-template-columns: 1fr; height: auto; }
	.erms-maplist { max-height: 340px; border-right: 0; border-bottom: 1px solid var(--line); }
	.erms-mapcanvas { height: 60vh; min-height: 400px; }
	.erms-row { grid-template-columns: 160px 1fr; }
	.erms-modal__grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
	.erms-row { grid-template-columns: 1fr; }
	.erms-f2 { flex: 1 1 45%; }
}
