/* ==========================================================================
   WARBOR AI Shopping Assistant — Chat Widget
   Dark luxury design, coerente con tema WARBOR
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variables
   -------------------------------------------------------------------------- */
:root {
	--ai-bg: #0B0B0D;
	--ai-bg-card: #1A1A20;
	--ai-bg-elevated: #222228;
	--ai-bg-input: #16161C;
	--ai-gold: #C8A96B;
	--ai-gold-dark: #B8914F;
	--ai-gold-grad: linear-gradient(135deg, #8E6A35, #C8A96B, #E6CF9A);
	--ai-text: #F5F1E8;
	--ai-text-mid: #DDD7CD;
	--ai-text-muted: #A8A29A;
	--ai-radius: 16px;
	--ai-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 60px rgba(200, 169, 107, 0.06);
	--ai-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.df-ai-chat {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 99999;
	font-family: var(--ai-font);
	font-size: 14px;
	line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Toggle Button — pulsante circolare flottante
   -------------------------------------------------------------------------- */
.df-ai-chat-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: var(--ai-gold-grad);
	color: #0B0B0D;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(200, 169, 107, 0.3), 0 0 40px rgba(200, 169, 107, 0.08);
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
	position: relative;
	padding: 0;
	line-height: 1;
	overflow: visible;
}

/* Forza visibilita' SVG dentro toggle e send */
.df-ai-chat-toggle svg,
.df-ai-chat-send svg {
	display: block !important;
	width: 28px !important;
	height: 28px !important;
	stroke: #0B0B0D !important;
	fill: none !important;
	pointer-events: none;
	flex-shrink: 0;
}

.df-ai-chat-send svg {
	width: 20px !important;
	height: 20px !important;
}

.df-ai-chat-toggle:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 28px rgba(200, 169, 107, 0.4), 0 0 50px rgba(200, 169, 107, 0.12);
}

.df-ai-chat-toggle:active {
	transform: scale(0.96);
}

.df-ai-chat-icon-close {
	display: none;
}

.df-ai-chat-toggle--open .df-ai-chat-icon-open {
	display: none;
}

.df-ai-chat-toggle--open .df-ai-chat-icon-close {
	display: block;
}

/* --------------------------------------------------------------------------
   Testo invito (senza nuvoletta)
   -------------------------------------------------------------------------- */
.df-ai-chat-bubble {
	position: absolute;
	bottom: 72px;
	right: 0;
	background: transparent;
	border: none;
	padding: 0;
	color: var(--ai-text, #F5F1E8);
	font-size: 13px;
	line-height: 1.4;
	white-space: nowrap;
	cursor: pointer;
	z-index: 1;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
	animation: dfAiBubbleIn 0.4s ease;
}

@keyframes dfAiBubbleIn {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Pulse ring animation per attirare l'attenzione */
.df-ai-chat-toggle::before {
	content: "";
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 2px solid rgba(200, 169, 107, 0.3);
	animation: dfAiPulse 2.5s ease-in-out infinite;
	pointer-events: none;
}

.df-ai-chat-toggle--open::before {
	display: none;
}

@keyframes dfAiPulse {
	0%, 100% { transform: scale(1); opacity: 1; }
	50% { transform: scale(1.15); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Chat Window
   -------------------------------------------------------------------------- */
.df-ai-chat-window {
	position: absolute;
	bottom: 76px;
	right: 0;
	width: 380px;
	max-height: 520px;
	background: var(--ai-bg-card);
	border: 1px solid rgba(200, 169, 107, 0.12);
	border-radius: var(--ai-radius);
	box-shadow: var(--ai-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: dfAiSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Forza hidden anche se altri stili lo sovrascrivono */
.df-ai-chat-window[hidden] {
	display: none !important;
}

@keyframes dfAiSlideUp {
	from { opacity: 0; transform: translateY(16px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.df-ai-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px;
	background: linear-gradient(135deg, rgba(200, 169, 107, 0.08) 0%, rgba(200, 169, 107, 0.02) 100%);
	border-bottom: 1px solid rgba(200, 169, 107, 0.1);
}

.df-ai-chat-header-info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.df-ai-chat-avatar {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: var(--ai-gold-grad);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #0B0B0D;
	flex-shrink: 0;
}

.df-ai-chat-header-info strong {
	display: block;
	color: var(--ai-text);
	font-size: 14px;
	font-weight: 700;
}

.df-ai-chat-status {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #22C55E;
}

.df-ai-chat-status::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #22C55E;
	box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.df-ai-chat-close {
	background: none;
	border: none;
	color: var(--ai-text-muted);
	font-size: 28px;
	cursor: pointer;
	z-index: 10;
	pointer-events: auto;
	min-width: 36px;
	min-height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4px 8px;
	line-height: 1;
	border-radius: 8px;
	transition: color 0.2s, background 0.2s;
}

.df-ai-chat-close:hover {
	color: var(--ai-text);
	background: rgba(200, 169, 107, 0.08);
}

/* --------------------------------------------------------------------------
   Messages Area
   -------------------------------------------------------------------------- */
.df-ai-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-height: 280px;
	max-height: 340px;
	scrollbar-width: thin;
	scrollbar-color: rgba(200, 169, 107, 0.15) transparent;
}

.df-ai-chat-messages::-webkit-scrollbar {
	width: 4px;
}

.df-ai-chat-messages::-webkit-scrollbar-thumb {
	background: rgba(200, 169, 107, 0.15);
	border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Message Bubbles
   -------------------------------------------------------------------------- */
.df-ai-msg {
	display: flex;
	animation: dfAiMsgIn 0.3s ease;
}

@keyframes dfAiMsgIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.df-ai-msg--user {
	justify-content: flex-end;
}

.df-ai-msg--bot {
	justify-content: flex-start;
}

.df-ai-msg-content {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13px;
	line-height: 1.55;
	word-wrap: break-word;
}

.df-ai-msg--user .df-ai-msg-content {
	background: var(--ai-gold-grad);
	color: #0B0B0D;
	border-bottom-right-radius: 4px;
	font-weight: 500;
}

.df-ai-msg--bot .df-ai-msg-content {
	background: var(--ai-bg-elevated);
	color: var(--ai-text-mid);
	border-bottom-left-radius: 4px;
	border: 1px solid rgba(200, 169, 107, 0.06);
}

.df-ai-msg--bot .df-ai-msg-content a {
	color: var(--ai-gold);
	text-decoration: none;
	font-weight: 600;
	transition: color 0.2s;
}

.df-ai-msg--bot .df-ai-msg-content a:hover {
	color: #E6CF9A;
	text-decoration: underline;
}

/* Disclaimer */
.df-ai-msg-disclaimer {
	display: block;
	margin-top: 8px;
	font-size: 10px;
	color: var(--ai-text-muted);
	opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Typing Indicator
   -------------------------------------------------------------------------- */
.df-ai-dots {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	height: 20px;
}

.df-ai-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ai-gold);
	opacity: 0.4;
	animation: dfAiDot 1.4s ease-in-out infinite;
}

.df-ai-dots span:nth-child(2) {
	animation-delay: 0.2s;
}

.df-ai-dots span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes dfAiDot {
	0%, 60%, 100% { opacity: 0.4; transform: scale(1); }
	30% { opacity: 1; transform: scale(1.3); }
}

/* --------------------------------------------------------------------------
   Input Form
   -------------------------------------------------------------------------- */
.df-ai-chat-form {
	display: flex;
	gap: 8px;
	padding: 12px 16px;
	background: var(--ai-bg);
	border-top: 1px solid rgba(200, 169, 107, 0.08);
}

.df-ai-chat-input {
	flex: 1;
	background: var(--ai-bg-input);
	border: 1px solid rgba(200, 169, 107, 0.1);
	border-radius: 10px;
	padding: 10px 14px;
	color: var(--ai-text);
	font-size: 13px;
	font-family: var(--ai-font);
	outline: none;
	transition: border-color 0.2s;
}

.df-ai-chat-input::placeholder {
	color: var(--ai-text-muted);
}

.df-ai-chat-input:focus {
	border-color: rgba(200, 169, 107, 0.3);
}

.df-ai-chat-input:disabled {
	opacity: 0.5;
}

.df-ai-chat-send {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	border: none;
	background: var(--ai-gold-grad);
	color: #0B0B0D;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: transform 0.2s, box-shadow 0.2s;
	padding: 0;
	line-height: 1;
	overflow: visible;
}

.df-ai-chat-send:hover {
	transform: scale(1.06);
	box-shadow: 0 4px 16px rgba(200, 169, 107, 0.3);
}

.df-ai-chat-send:active {
	transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   Responsive — Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
	.df-ai-chat {
		bottom: 16px;
		right: 16px;
		left: 16px;
	}

	.df-ai-chat-toggle {
		position: fixed;
		bottom: 16px;
		right: 16px;
	}

	.df-ai-chat-window {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-height: 85vh;
		border-radius: var(--ai-radius) var(--ai-radius) 0 0;
	}

	.df-ai-chat-messages {
		max-height: calc(85vh - 140px);
	}
}
