/* Phoenix Sticky Bar - frontend styles */

:root {
	--phoenix-accent: #e4032e;
	--phoenix-text: #4a4a4a;
	--phoenix-bar-bg: #ffffff;
	--phoenix-border: #ececec;
}

.phoenix-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99998;
	display: flex;
	align-items: stretch;
	justify-content: space-around;
	background: var(--phoenix-bar-bg);
	border-top: 3px solid var(--phoenix-accent);
	box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
	padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.phoenix-item {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--phoenix-text);
	text-decoration: none;
	padding: 6px 2px;
	font-size: 12px;
	line-height: 1;
	-webkit-tap-highlight-color: transparent;
}

.phoenix-item:hover,
.phoenix-item:focus-visible {
	color: var(--phoenix-accent);
}

.phoenix-item.is-active {
	color: var(--phoenix-accent);
}

.phoenix-icon {
	width: 24px;
	height: 24px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.phoenix-icon svg {
	width: 24px;
	height: 24px;
}

.phoenix-label {
	font-size: 11px;
	font-weight: 500;
}

/* "Solo su mobile": la barra si nasconde oltre 782px solo quando il body
   porta la classe phoenix-mobile-only (aggiunta lato PHP in base all'opzione).
   Tenere questa regola nel foglio di stile statico (invece che in uno
   <style> inline generato per ogni richiesta) la rende più semplice da
   verificare da "Visualizza sorgente" e più resistente alle cache di pagina. */
@media (min-width: 783px) {
	body.phoenix-mobile-only .phoenix-bar {
		display: none !important;
	}
}

body.phoenix-bar-disabled .phoenix-bar {
	display: none !important;
}

/* ---------------- Modal shared ---------------- */

.phoenix-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(20, 20, 20, 0.45);
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.phoenix-modal-overlay[hidden] {
	display: none;
}

@media (min-width: 600px) {
	.phoenix-modal-overlay {
		align-items: center;
	}
}

.phoenix-modal {
	background: #fff;
	width: 100%;
	max-width: 420px;
	border-radius: 16px 16px 0 0;
	padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
	position: relative;
	box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.2);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	animation: phoenix-slide-up 0.2s ease-out;
}

@media (min-width: 600px) {
	.phoenix-modal {
		border-radius: 16px;
	}
}

@keyframes phoenix-slide-up {
	from { transform: translateY(24px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

.phoenix-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 4px;
}

.phoenix-modal h2 {
	margin: 0 0 4px;
	font-size: 20px;
	color: #222;
}

.phoenix-modal > p {
	margin: 0 0 20px;
	color: #666;
	font-size: 14px;
}

/* ---------------- Assistenza modal ---------------- */

.phoenix-contact-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.phoenix-contact-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 16px 8px;
	border-radius: 12px;
	background: #fafafa;
	border: 1px solid var(--phoenix-border);
	text-decoration: none;
	color: #333;
	font-size: 13px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease;
}

.phoenix-contact-card:hover {
	background: #f2f2f2;
	transform: translateY(-1px);
}

.phoenix-contact-icon {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(228, 3, 46, 0.08);
	color: var(--phoenix-accent);
	display: flex;
	align-items: center;
	justify-content: center;
}

.phoenix-contact-icon svg {
	width: 22px;
	height: 22px;
}

/* ---------------- Chatbot modal ---------------- */

.phoenix-modal--chatbot {
	display: flex;
	flex-direction: column;
	height: 70vh;
	max-height: 560px;
}

.phoenix-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.phoenix-chat-header h2 {
	margin: 0;
}

.phoenix-chat-messages {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 4px 2px 12px;
}

.phoenix-msg {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.4;
}

.phoenix-msg--bot {
	align-self: flex-start;
	background: #f0f0f0;
	color: #222;
	border-bottom-left-radius: 4px;
}

.phoenix-msg--user {
	align-self: flex-end;
	background: var(--phoenix-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.phoenix-chat-form {
	display: flex;
	gap: 8px;
	border-top: 1px solid var(--phoenix-border);
	padding-top: 12px;
}

.phoenix-chat-form input[type="text"] {
	flex: 1;
	border: 1px solid var(--phoenix-border);
	border-radius: 20px;
	padding: 10px 16px;
	font-size: 14px;
	outline: none;
}

.phoenix-chat-form input[type="text"]:focus {
	border-color: var(--phoenix-accent);
}

.phoenix-chat-form button {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: var(--phoenix-accent);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
}

.phoenix-chat-form button svg {
	width: 18px;
	height: 18px;
}

.phoenix-chat-disclaimer {
	margin: 10px 0 0;
	font-size: 11px;
	color: #999;
	text-align: center;
}

/* Prevent page content from being hidden behind the bar */
body.phoenix-has-bar {
	padding-bottom: 64px;
}

/* ---------------- Floating category button ---------------- */
/* Always visible (desktop + mobile), positioned above the sticky bar so it
   never overlaps it. When the bar is hidden (disabled, or hidden on desktop
   via "solo su mobile"), the button drops down to a normal corner position. */

.phoenix-category-fab {
	position: fixed;
	right: 16px;
	bottom: calc(76px + env(safe-area-inset-bottom, 0px));
	z-index: 99996;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	max-width: calc(100vw - 32px);
	padding: 10px 18px 10px 14px;
	border-radius: 999px;
	background: var(--phoenix-accent);
	color: #fff;
	text-decoration: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 13px;
	font-weight: 600;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.phoenix-category-fab:hover,
.phoenix-category-fab:focus-visible {
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.phoenix-category-fab .phoenix-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.phoenix-category-fab .phoenix-icon svg {
	width: 18px;
	height: 18px;
}

.phoenix-category-fab-label {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Bar hidden entirely -> button sits at the normal bottom-right corner. */
body.phoenix-bar-disabled .phoenix-category-fab {
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* Bar hidden on desktop only ("solo su mobile") -> same adjustment ≥783px. */
@media (min-width: 783px) {
	body.phoenix-mobile-only .phoenix-category-fab {
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}
}

/* The label stays horizontal at every screen size (mobile included) — no
   rotation/vertical text. On very narrow screens the max-width + ellipsis
   rule above keeps the pill from overflowing the viewport. */
@media (max-width: 380px) {
	.phoenix-category-fab {
		padding: 9px 14px 9px 12px;
		gap: 6px;
	}

	.phoenix-category-fab-label {
		max-width: 46vw;
	}
}
