@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
/* Cagliari Case — widget chatbot immobili (v2.0)
   Note sul mobile: su iPhone l'altezza utile non è mai 100vh (barre di Safari e
   tastiera), quindi il pannello viene dimensionato da chat.js con visualViewport
   e legge le due variabili --cc-h / --cc-top. Il CSS qui sotto tiene solo i
   valori di ripiego, validi anche se il JS non parte. */

#cc-chat {
	position: fixed; right: 20px; bottom: 20px; z-index: 99999;
	font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
	right: calc(20px + env(safe-area-inset-right, 0px));
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
#cc-chat button { font-family: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

#cc-chat-fab {
	width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
	background: #1C3B75; color: #fff; display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 20px rgba(28,59,117,.35); transition: transform .15s;
}
#cc-chat-fab:active { transform: scale(.94); }

#cc-chat-win {
	position: fixed; right: 0; top: 0; bottom: 0; height: 100dvh; width: 430px; max-width: 92vw;
	background: #fff; border-radius: 0;
	box-shadow: -8px 0 40px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden;
	animation: cc-slide-in .25s ease-out;
}
@keyframes cc-slide-in {
	from { transform: translateX(100%); }
	to { transform: translateX(0); }
}

#cc-chat-head {
	background: #1C3B75; color: #fff; padding: 12px 16px;
	padding-top: max(12px, env(safe-area-inset-top, 0px));
	display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-shrink: 0;
}
#cc-chat-head > div:first-of-type { min-width: 0; }
#cc-chat-head strong { font-size: 16px; }
#cc-chat-head small {
	opacity: .8; font-size: 12px; display: block;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#cc-chat-head .cc-head-right { display: flex; align-items: center; gap: 4px; }
#cc-chat-close {
	background: none; border: 0; color: #fff; font-size: 26px; cursor: pointer; line-height: 1;
	width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
#cc-chat-close:active { background: rgba(255,255,255,.18); }
#cc-chat-call {
	background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.4); color: #fff;
	border-radius: 20px; padding: 8px 13px; font-size: 12.5px; cursor: pointer;
	display: inline-flex; align-items: center; gap: 6px; min-height: 38px; white-space: nowrap;
}
#cc-chat-call:active { background: rgba(255,255,255,.28); }

/* maniglia di trascinamento: compare solo sul pannello a tutto schermo */
#cc-chat-grab { display: none; }

#cc-chat-msgs {
	flex: 1; overflow-y: auto; padding: 14px; background: #F7F9FC;
	overscroll-behavior: contain;               /* niente scroll della pagina sotto */
	-webkit-overflow-scrolling: touch;
}
#cc-chat .cc-msg {
	max-width: 85%; padding: 9px 13px; border-radius: 14px; margin-bottom: 8px;
	font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line;
}
#cc-chat .cc-bot { background: #EDF1F8; color: #1E2A5A; border-bottom-left-radius: 4px; }
#cc-chat .cc-user { background: #1C3B75; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
#cc-chat .cc-dots i { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: #98A6C8; animation: ccb 1s infinite; }
#cc-chat .cc-dots i:nth-child(2) { animation-delay: .2s; }
#cc-chat .cc-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ccb { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

#cc-chat .cc-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
#cc-chat .cc-quick-btn {
	background: #fff; border: 1px solid #1C3B75; color: #1C3B75; border-radius: 20px;
	padding: 6px 13px; font-size: 13px; cursor: pointer;
}
#cc-chat .cc-quick-btn:active { background: #1C3B75; color: #fff; }

#cc-chat .cc-cards { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
#cc-chat .cc-card {
	display: flex; gap: 10px; background: #fff; border: 1px solid #E3E9F4; border-radius: 12px;
	overflow: hidden; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .12s;
	-webkit-tap-highlight-color: transparent;
}
#cc-chat .cc-card:active { transform: scale(.985); box-shadow: 0 2px 10px rgba(28,59,117,.18); }
#cc-chat .cc-card img { width: 96px; height: 84px; object-fit: cover; flex-shrink: 0; background: #EDF1F8; }
#cc-chat .cc-card-body { padding: 8px 10px 8px 0; min-width: 0; }
#cc-chat .cc-card-title { font-size: 13px; font-weight: 500; color: #1E2A5A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cc-chat .cc-card-price { font-size: 14px; font-weight: 700; color: #1C3B75; margin: 2px 0; }
#cc-chat .cc-card-meta { font-size: 12px; color: #6B7A99; }

#cc-chat-form { display: flex; align-items: center; border-top: 1px solid #E3E9F4; background: #fff; flex-shrink: 0; }
#cc-chat-input {
	flex: 1; border: 0; padding: 13px 14px; font-size: 16px; outline: none; min-width: 0;
	background: transparent; color: #1E2A5A; font-family: inherit;
}
#cc-chat-form button {
	border: 0; background: none; color: #1C3B75; cursor: pointer;
	width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
#cc-chat-form button:active { color: #0E1B33; }

#cc-chat-lead { padding: 10px 14px; border-top: 1px solid #E3E9F4; display: flex; flex-direction: column; gap: 8px; background: #fff; flex-shrink: 0; }
#cc-chat-lead input { border: 1px solid #D5DDEC; border-radius: 8px; padding: 11px 12px; font-size: 16px; font-family: inherit; color: #1E2A5A; }
#cc-chat-lead input:focus { outline: 2px solid #1C3B75; outline-offset: -1px; }
#cc-lead-send { background: #1C3B75; color: #fff; border: 0; border-radius: 8px; padding: 12px; font-size: 15px; cursor: pointer; min-height: 46px; }
#cc-lead-send:active { background: #0E1B33; }
#cc-lead-errore { color: #B3261E; font-size: 13px; margin: -2px 0 0; }

/* ---------------------------------------------------------------------------
   Telefono: pannello a tutto schermo, altezza guidata da visualViewport
   --------------------------------------------------------------------------- */
/* telefono: schermo stretto, oppure schermo basso su dispositivo touch
   (iPhone in orizzontale: 844 di larghezza ma solo 390 di altezza) */
@media (max-width: 600px), (max-height: 520px) and (pointer: coarse) {
	#cc-chat-win {
		width: 100%; max-width: 100%; left: 0; right: 0;
		top: var(--cc-top, 0px); bottom: auto;
		height: var(--cc-h, 100dvh);
		box-shadow: 0 -6px 30px rgba(0,0,0,.3);
		animation: cc-slide-up .28s cubic-bezier(.32,.72,0,1);
		transition: transform .22s cubic-bezier(.32,.72,0,1);
	}
	@keyframes cc-slide-up {
		from { transform: translateY(100%); }
		to { transform: translateY(0); }
	}
	#cc-chat-win.cc-trascina { transition: none; }

	/* col pannello a tutto schermo il pallino galleggiante non serve più */
	#cc-chat.cc-aperto #cc-chat-fab { display: none; }

	#cc-chat-grab {
		display: block; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
		width: 38px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.45); pointer-events: none;
	}
	#cc-chat-head { padding: 16px 12px 12px; touch-action: pan-y; }
	#cc-chat-head strong { font-size: 17px; }
	#cc-chat-call { min-height: 44px; font-size: 13px; padding: 8px 14px; }

	#cc-chat-msgs { padding: 12px 12px 4px; scroll-padding-bottom: 12px; }
	#cc-chat .cc-msg { font-size: 15px; line-height: 1.5; max-width: 88%; padding: 10px 14px; }

	#cc-chat .cc-quick { gap: 8px; margin: 6px 0 12px; }
	#cc-chat .cc-quick-btn { font-size: 14px; padding: 10px 16px; min-height: 44px; }

	#cc-chat .cc-card { align-items: stretch; }
	#cc-chat .cc-card img { width: 88px; height: auto; min-height: 88px; align-self: stretch; }
	#cc-chat .cc-card-body { padding: 10px 12px 10px 0; }
	#cc-chat .cc-card-title {
		font-size: 14px; white-space: normal; display: -webkit-box;
		-webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3;
	}
	#cc-chat .cc-card-price { font-size: 15px; margin: 3px 0; }
	#cc-chat .cc-card-meta { font-size: 12.5px; line-height: 1.4; }

	/* barra di scrittura: sopra la barra home dell'iPhone, ma non quando c'è la tastiera */
	#cc-chat-form { padding-bottom: env(safe-area-inset-bottom, 0px); }
	#cc-chat-lead { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
	#cc-chat.cc-tastiera #cc-chat-form,
	#cc-chat.cc-tastiera #cc-chat-lead { padding-bottom: 0; }
	#cc-chat.cc-tastiera #cc-chat-lead { padding-bottom: 8px; }
	#cc-chat-input { padding: 15px 14px; }

	/* con la tastiera aperta lo spazio è poco: intestazione compatta */
	#cc-chat.cc-tastiera #cc-chat-head { padding: 8px 14px; }
	#cc-chat.cc-tastiera #cc-chat-head small { display: none; }
	#cc-chat.cc-tastiera #cc-chat-grab { display: none; }
}

/* schermi molto bassi (iPhone in orizzontale, tastiera aperta) */
@media (max-height: 460px) and (max-width: 900px) {
	#cc-chat-head small { display: none; }
	#cc-chat-head { padding: 8px 14px; }
	#cc-chat .cc-quick-btn { min-height: 38px; padding: 7px 13px; }
}

/* il puntatore fine (mouse) è l'unico che deve avere gli stati hover:
   su iOS :hover resta appiccicato dopo il tocco */
@media (hover: hover) and (pointer: fine) {
	#cc-chat-fab:hover { transform: scale(1.07); }
	#cc-chat-call:hover { background: rgba(255,255,255,.25); }
	#cc-chat-close:hover { background: rgba(255,255,255,.15); }
	#cc-chat .cc-quick-btn:hover { background: #1C3B75; color: #fff; }
	#cc-chat .cc-card:hover { box-shadow: 0 4px 14px rgba(28,59,117,.15); }
}

@media (prefers-reduced-motion: reduce) {
	#cc-chat-win { animation: none; transition: none; }
	#cc-chat-fab { transition: none; }
}

/* fix: l'attributo hidden deve vincere sempre */
#cc-chat-lead[hidden], #cc-chat-win[hidden] { display: none !important; }

/* Barra di ricerca AI (shortcode [cc_chat_bar]) — pill con bordo sfumato */
.cc-chat-bar {
	display: block; width: 100%; padding: 2px; border: 0; border-radius: 999px;
	background: linear-gradient(90deg, #2E9BFF, #8A5CFF, #FF3D8A);
	box-shadow: 0 4px 16px rgba(28,59,117,.08);
	font-family: 'DM Sans', system-ui, sans-serif; margin: 0;
}
.cc-chat-bar button[hidden] { display: none !important; }
.cc-chat-bar .cc-bar-in {
	display: flex; align-items: center; background: #fff; border-radius: 999px; width: 100%;
}
.cc-bar-icon {
	display: flex; align-items: center; color: #1E2A5A;
	padding: 0 16px 0 22px; margin-right: 4px;
	border-right: 1px solid #E3E9F4; align-self: stretch;
}
.cc-chat-bar input {
	flex: 1; border: 0; outline: none; padding: 17px 24px 17px 16px; font-size: 20px;
	color: #1E2A5A; background: transparent; min-width: 0; border-radius: 999px;
	font-family: 'DM Sans', system-ui, sans-serif;
}
.cc-chat-bar input,
.cc-chat-bar input:focus,
.cc-chat-bar input:hover,
.cc-chat-bar input:active {
	border: 0 !important; outline: 0 !important; box-shadow: none !important;
	background: transparent !important;
}
.cc-chat-bar input::placeholder { color: #8D9BBC; }
@media (max-width: 560px) {
	.cc-chat-bar input { padding: 14px 18px 14px 12px; font-size: 17px; }
	.cc-bar-icon { padding: 0 12px 0 16px; }
}

/* quando la chat è aperta la pagina sotto non deve scorrere */
html.cc-bloccato, body.cc-bloccato { overflow: hidden !important; }
body.cc-bloccato { position: fixed; width: 100%; }

/* consenso privacy nel modulo di richiamata (2026-09-26) */
#cc-chat #cc-lead-privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; color: #3A4466; cursor: pointer; }
#cc-chat #cc-lead-privacy input { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; margin: 1px 0 0; padding: 0; border-radius: 4px; accent-color: #1C3B75; }
#cc-chat #cc-lead-privacy a { color: #1C3B75; text-decoration: underline; }
