/**
 * Dealer CRM — Showroom digitale (frontend)
 * Tutti i colori sono design token: per ribrandizzare basta cambiare :root.
 */

:root {
	--dcrm-primary: #0b2545;
	--dcrm-primary-600: #13315c;
	--dcrm-accent: #c8102e;
	--dcrm-accent-600: #9e0c24;
	--dcrm-ink: #10151f;
	--dcrm-muted: #5b6676;
	--dcrm-line: #e3e8ef;
	--dcrm-bg: #f6f8fb;
	--dcrm-surface: #ffffff;
	--dcrm-success: #16a34a;
	--dcrm-warning: #d97706;
	--dcrm-danger: #dc2626;
	--dcrm-radius: 12px;
	--dcrm-radius-sm: 8px;
	--dcrm-shadow: 0 1px 2px rgba(16, 21, 31, .06), 0 8px 24px rgba(16, 21, 31, .06);
	--dcrm-shadow-lg: 0 2px 4px rgba(16, 21, 31, .06), 0 16px 40px rgba(16, 21, 31, .1);
	--dcrm-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	--dcrm-gap: 20px;
}

.dcrm-showroom,
.dcrm-form,
.dcrm-finance,
.dcrm-locations,
.dcrm-vehicle-single {
	font-family: var(--dcrm-font);
	color: var(--dcrm-ink);
	box-sizing: border-box;
}

.dcrm-showroom *,
.dcrm-form *,
.dcrm-finance *,
.dcrm-vehicle-single * {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ Filtri */

.dcrm-filters {
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius);
	box-shadow: var(--dcrm-shadow);
	padding: 20px;
	margin-bottom: 24px;
}

.dcrm-filters__row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 14px;
	margin-bottom: 14px;
}

.dcrm-filters__row:last-of-type {
	margin-bottom: 0;
}

.dcrm-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 13px;
}

.dcrm-field > span {
	font-weight: 600;
	color: var(--dcrm-muted);
	letter-spacing: .01em;
}

.dcrm-field input,
.dcrm-field select,
.dcrm-field textarea {
	width: 100%;
	padding: 10px 12px;
	font: inherit;
	font-size: 14px;
	color: var(--dcrm-ink);
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius-sm);
	transition: border-color .15s ease, box-shadow .15s ease;
}

.dcrm-field input:focus,
.dcrm-field select:focus,
.dcrm-field textarea:focus {
	outline: none;
	border-color: var(--dcrm-primary);
	box-shadow: 0 0 0 3px rgba(11, 37, 69, .12);
}

.dcrm-filters__actions {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--dcrm-line);
}

/* ------------------------------------------------------------------ Bottoni */

.dcrm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 11px 20px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	border: 1px solid transparent;
	border-radius: var(--dcrm-radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: background-color .15s ease, transform .1s ease, box-shadow .15s ease;
}

.dcrm-btn:hover { transform: translateY(-1px); }
.dcrm-btn:active { transform: translateY(0); }

.dcrm-btn--primary {
	background: var(--dcrm-primary);
	color: #fff;
}

.dcrm-btn--primary:hover { background: var(--dcrm-primary-600); color: #fff; }

.dcrm-btn--accent {
	background: var(--dcrm-accent);
	color: #fff;
}

.dcrm-btn--accent:hover { background: var(--dcrm-accent-600); color: #fff; }

.dcrm-btn--ghost {
	background: transparent;
	color: var(--dcrm-muted);
	border-color: var(--dcrm-line);
}

.dcrm-btn--ghost:hover { background: var(--dcrm-bg); color: var(--dcrm-ink); }

.dcrm-btn--block { width: 100%; }

/* ------------------------------------------------------------------ Griglia */

.dcrm-showroom__title {
	font-size: clamp(24px, 3vw, 34px);
	font-weight: 700;
	letter-spacing: -.02em;
	margin: 0 0 20px;
}

.dcrm-showroom__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.dcrm-count {
	font-size: 14px;
	color: var(--dcrm-muted);
	font-weight: 600;
}

.dcrm-sort select {
	padding: 9px 12px;
	font: inherit;
	font-size: 14px;
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius-sm);
	background: var(--dcrm-surface);
}

.dcrm-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: var(--dcrm-gap);
}

.dcrm-showroom[data-columns="2"] .dcrm-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
.dcrm-showroom[data-columns="4"] .dcrm-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.dcrm-grid.is-loading { opacity: .5; pointer-events: none; }

/* ------------------------------------------------------------------ Card */

.dcrm-vehicle-card {
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow .2s ease, transform .2s ease;
}

.dcrm-vehicle-card:hover {
	box-shadow: var(--dcrm-shadow-lg);
	transform: translateY(-2px);
}

.dcrm-vehicle-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--dcrm-bg);
	overflow: hidden;
}

.dcrm-vehicle-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .4s ease;
}

.dcrm-vehicle-card:hover .dcrm-vehicle-card__media img { transform: scale(1.04); }

.dcrm-vehicle-card__placeholder {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, #eef2f7, #dde5ef);
}

.dcrm-vehicle-card__badges {
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.dcrm-tag {
	display: inline-block;
	padding: 4px 9px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--dcrm-primary);
	background: rgba(255, 255, 255, .94);
	border-radius: 999px;
	backdrop-filter: blur(4px);
}

.dcrm-tag--promo { background: var(--dcrm-accent); color: #fff; }
.dcrm-tag--reserved { background: var(--dcrm-warning); color: #fff; }

.dcrm-vehicle-card__media-icons {
	position: absolute;
	bottom: 12px;
	right: 12px;
	display: flex;
	gap: 6px;
	font-size: 11px;
	font-weight: 700;
}

.dcrm-vehicle-card__media-icons span {
	background: rgba(16, 21, 31, .75);
	color: #fff;
	padding: 4px 8px;
	border-radius: 999px;
}

.dcrm-vehicle-card__body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 12px;
}

.dcrm-vehicle-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: -.01em;
}

.dcrm-vehicle-card__title a {
	color: var(--dcrm-ink);
	text-decoration: none;
}

.dcrm-vehicle-card__title a:hover { color: var(--dcrm-primary); }

.dcrm-vehicle-card__specs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 13px;
	color: var(--dcrm-muted);
}

.dcrm-vehicle-card__specs li {
	position: relative;
	padding-right: 10px;
}

.dcrm-vehicle-card__specs li:not(:last-child)::after {
	content: '';
	position: absolute;
	right: 0;
	top: 50%;
	width: 3px;
	height: 3px;
	background: currentColor;
	border-radius: 50%;
	transform: translateY(-50%);
	opacity: .5;
}

.dcrm-vehicle-card__footer {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid var(--dcrm-line);
}

.dcrm-price-block { display: flex; flex-direction: column; gap: 2px; }

.dcrm-price {
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -.02em;
	color: var(--dcrm-primary);
}

.dcrm-price-old {
	font-size: 14px;
	color: var(--dcrm-muted);
	text-decoration: line-through;
}

.dcrm-rate {
	font-size: 13px;
	font-weight: 600;
	color: var(--dcrm-accent);
}

.dcrm-vat-note {
	font-size: 11px;
	color: var(--dcrm-muted);
}

.dcrm-wishlist-toggle {
	width: 38px;
	height: 38px;
	font-size: 17px;
	line-height: 1;
	color: var(--dcrm-muted);
	background: var(--dcrm-bg);
	border: 1px solid var(--dcrm-line);
	border-radius: 50%;
	cursor: pointer;
	transition: all .15s ease;
}

.dcrm-wishlist-toggle:hover,
.dcrm-wishlist-toggle.is-active {
	color: #fff;
	background: var(--dcrm-accent);
	border-color: var(--dcrm-accent);
}

/* ------------------------------------------------------- Scheda veicolo */

.dcrm-vehicle-single { display: grid; gap: 32px; }

.dcrm-vehicle-hero {
	display: grid;
	grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
	gap: 28px;
	align-items: start;
}

.dcrm-gallery { display: grid; gap: 10px; }

.dcrm-gallery__main {
	aspect-ratio: 4 / 3;
	border-radius: var(--dcrm-radius);
	overflow: hidden;
	background: var(--dcrm-bg);
}

.dcrm-gallery__main img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dcrm-gallery__thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
	gap: 8px;
}

.dcrm-gallery__thumbs button {
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--dcrm-radius-sm);
	overflow: hidden;
	cursor: pointer;
	background: none;
	aspect-ratio: 4 / 3;
}

.dcrm-gallery__thumbs button.is-active { border-color: var(--dcrm-primary); }

.dcrm-gallery__thumbs img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dcrm-vehicle-aside {
	position: sticky;
	top: 24px;
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius);
	box-shadow: var(--dcrm-shadow);
	padding: 22px;
	display: grid;
	gap: 16px;
}

.dcrm-vehicle-aside .dcrm-price { font-size: 30px; }

.dcrm-specs-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.dcrm-specs-table th,
.dcrm-specs-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid var(--dcrm-line);
}

.dcrm-specs-table th {
	width: 45%;
	font-weight: 600;
	color: var(--dcrm-muted);
}

.dcrm-features-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 6px 18px;
	list-style: none;
	padding: 0;
	margin: 0;
	font-size: 14px;
}

.dcrm-features-list li { padding-left: 20px; position: relative; }

.dcrm-features-list li::before {
	content: '✓';
	position: absolute;
	left: 0;
	color: var(--dcrm-success);
	font-weight: 700;
}

.dcrm-section-title {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -.01em;
	margin: 0 0 14px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--dcrm-line);
}

.dcrm-emissions {
	background: var(--dcrm-bg);
	border-radius: var(--dcrm-radius);
	padding: 18px;
	font-size: 13px;
	color: var(--dcrm-muted);
}

/* ------------------------------------------------------------------ Form */

.dcrm-form {
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius);
	box-shadow: var(--dcrm-shadow);
	padding: 24px;
	display: grid;
	gap: 16px;
}

.dcrm-form--compact { padding: 18px; }

.dcrm-form__title {
	margin: 0;
	font-size: 19px;
	font-weight: 700;
}

.dcrm-form__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 14px;
}

.dcrm-field--full { grid-column: 1 / -1; }

.dcrm-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.dcrm-consent {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	font-size: 13px;
	color: var(--dcrm-muted);
	line-height: 1.5;
}

.dcrm-consent input { margin-top: 3px; flex-shrink: 0; }
.dcrm-consent a { color: var(--dcrm-primary); }

.dcrm-form__actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.dcrm-form__feedback { font-size: 14px; font-weight: 600; }
.dcrm-form__feedback.is-success { color: var(--dcrm-success); }
.dcrm-form__feedback.is-error { color: var(--dcrm-danger); }

.dcrm-form.is-sending { opacity: .6; pointer-events: none; }

/* ------------------------------------------------------------- Finanziamento */

.dcrm-finance {
	background: var(--dcrm-bg);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius);
	padding: 22px;
	display: grid;
	gap: 16px;
}

.dcrm-finance__title { margin: 0; font-size: 18px; font-weight: 700; }

.dcrm-finance__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 14px;
}

.dcrm-finance__result {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	background: var(--dcrm-primary);
	color: #fff;
	border-radius: var(--dcrm-radius-sm);
}

.dcrm-finance__label { font-size: 14px; opacity: .85; }
.dcrm-finance__amount { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.dcrm-finance__disclaimer { margin: 0; font-size: 12px; color: var(--dcrm-muted); line-height: 1.5; }

/* ------------------------------------------------------------------ Varie */

.dcrm-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 32px;
	flex-wrap: wrap;
}

.dcrm-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--dcrm-ink);
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius-sm);
	text-decoration: none;
}

.dcrm-pagination .page-numbers.current,
.dcrm-pagination .page-numbers:hover {
	background: var(--dcrm-primary);
	border-color: var(--dcrm-primary);
	color: #fff;
}

.dcrm-empty {
	grid-column: 1 / -1;
	padding: 48px 20px;
	text-align: center;
	color: var(--dcrm-muted);
	background: var(--dcrm-bg);
	border-radius: var(--dcrm-radius);
	font-size: 15px;
}

.dcrm-locations {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: var(--dcrm-gap);
}

.dcrm-location {
	background: var(--dcrm-surface);
	border: 1px solid var(--dcrm-line);
	border-radius: var(--dcrm-radius);
	padding: 20px;
}

.dcrm-location h3 { margin: 0 0 10px; font-size: 17px; }
.dcrm-location p { margin: 0 0 6px; font-size: 14px; color: var(--dcrm-muted); }
.dcrm-location a { color: var(--dcrm-primary); text-decoration: none; }

.dcrm-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(16px);
	padding: 12px 22px;
	background: var(--dcrm-ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	border-radius: 999px;
	box-shadow: var(--dcrm-shadow-lg);
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
	z-index: 99999;
}

.dcrm-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 900px) {
	.dcrm-vehicle-hero { grid-template-columns: 1fr; }
	.dcrm-vehicle-aside { position: static; }
}

@media (max-width: 600px) {
	.dcrm-grid { grid-template-columns: 1fr; }
	.dcrm-filters { padding: 16px; }
	.dcrm-showroom__meta { flex-direction: column; align-items: flex-start; }
	.dcrm-price { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
	.dcrm-vehicle-card,
	.dcrm-vehicle-card__media img,
	.dcrm-btn,
	.dcrm-toast {
		transition: none;
	}
}

/* ---------------------------------------------------------------------
 * "Avvisami quando arriva" — modulo ricerca salvata
 * ------------------------------------------------------------------- */

.dcrm-alert-form {
	margin: 28px 0;
	padding: 20px 22px;
	background: var( --dcrm-color-surface, #f7f8fa );
	border: 1px solid var( --dcrm-color-border, #e2e5ea );
	border-radius: 14px;
}

.dcrm-alert-form__title {
	margin: 0 0 6px;
	font-size: 18px;
}

.dcrm-alert-form__text {
	margin: 0 0 12px;
	color: var( --dcrm-color-muted, #64748b );
	font-size: 14px;
}

.dcrm-alert-form__summary {
	margin: 0 0 12px;
	font-size: 14px;
}

.dcrm-alert-form__row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.dcrm-alert-form__row input[type="email"] {
	flex: 1 1 220px;
	min-width: 0;
	padding: 11px 13px;
	border: 1px solid var( --dcrm-color-border, #e2e5ea );
	border-radius: 10px;
	font: inherit;
}

.dcrm-alert-form__row select {
	flex: 0 1 190px;
	padding: 11px 13px;
	border: 1px solid var( --dcrm-color-border, #e2e5ea );
	border-radius: 10px;
	font: inherit;
	background: #fff;
}

.dcrm-alert-form__row button {
	flex: 0 0 auto;
	padding: 11px 22px;
	border: 0;
	border-radius: 10px;
	background: var( --dcrm-color-primary, #0b2545 );
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.dcrm-alert-form__row button[disabled] {
	opacity: 0.6;
	cursor: default;
}

.dcrm-alert-form__consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-top: 12px;
	font-size: 13px;
	color: var( --dcrm-color-muted, #64748b );
}

.dcrm-alert-form__feedback {
	margin: 10px 0 0;
	font-size: 14px;
	min-height: 1em;
}

.dcrm-alert-form__feedback.is-ok {
	color: #15803d;
}

.dcrm-alert-form__feedback.is-error {
	color: #b91c1c;
}
