/**
 * Victoria Chat — widget styles
 * Variables CSS pilotées par PHP via Victoria_Frontend::build_inline_styles()
 */

#victoria-chat-widget,
#victoria-chat-widget * {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

#victoria-chat-widget {
	position: fixed;
	z-index: 999999;
}

/* Position horizontale */
#victoria-chat-widget.victoria-pos-h-right {
	right: var(--victoria-offset-h);
}
#victoria-chat-widget.victoria-pos-h-left {
	left: var(--victoria-offset-h);
}

/* Position verticale */
#victoria-chat-widget.victoria-pos-v-bottom {
	bottom: var(--victoria-offset-v);
	top: auto;
}
#victoria-chat-widget.victoria-pos-v-top {
	top: var(--victoria-offset-v);
	bottom: auto;
}
#victoria-chat-widget.victoria-pos-v-middle {
	top: 50%;
	bottom: auto;
	transform: translateY(-50%);
}

/* ============================================
   BOUTON TOGGLE
   ============================================ */
#victoria-chat-toggle {
	width: var(--victoria-btn-size);
	height: var(--victoria-btn-size);
	border-radius: 50%;
	background: var(--victoria-primary);
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.18s ease, background 0.18s ease;
	padding: 0;
	margin: 0;
}
#victoria-chat-toggle:hover {
	transform: scale(1.07);
	background: var(--victoria-secondary);
}
#victoria-chat-toggle:focus-visible {
	outline: 3px solid var(--victoria-secondary);
	outline-offset: 3px;
}

/* ============================================
   FENÊTRE DE CHAT
   ============================================ */
#victoria-chat-window {
	position: absolute;
	bottom: calc(var(--victoria-btn-size) + 16px);
	width: var(--victoria-window-w);
	height: var(--victoria-window-h);
	max-height: calc(100vh - 100px);
	background: var(--victoria-bg);
	color: var(--victoria-text);
	border-radius: 14px;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.20);
	display: none;
	flex-direction: column;
	overflow: hidden;
}
#victoria-chat-widget.victoria-pos-h-right #victoria-chat-window {
	right: 0;
}
#victoria-chat-widget.victoria-pos-h-left #victoria-chat-window {
	left: 0;
}
#victoria-chat-widget.victoria-pos-v-top #victoria-chat-window {
	bottom: auto;
	top: calc(var(--victoria-btn-size) + 16px);
}
#victoria-chat-widget.victoria-open #victoria-chat-window {
	display: flex;
}

/* Mobile : plein écran */
@media (max-width: 640px) {
	#victoria-chat-window {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
}

/* ============================================
   HEADER
   ============================================ */
#victoria-chat-header {
	background: var(--victoria-primary);
	color: #fff;
	padding: 14px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
#victoria-chat-header strong {
	display: block;
	font-size: 15px;
	font-weight: 600;
}
#victoria-chat-header small {
	display: block;
	font-size: 12px;
	opacity: 0.85;
}
#victoria-chat-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	width: 32px;
	height: 32px;
	border-radius: 4px;
	transition: background 0.15s ease;
}
#victoria-chat-close:hover {
	background: rgba(255, 255, 255, 0.18);
}

/* ============================================
   MENTION RGPD
   ============================================ */
#victoria-chat-rgpd {
	position: relative;
	background: #f4f4f7;
	color: #555;
	font-size: 11px;
	line-height: 1.4;
	padding: 8px 30px 8px 14px;
	border-bottom: 1px solid #e5e7eb;
	text-align: center;
}
#victoria-chat-rgpd a {
	color: var(--victoria-primary);
	text-decoration: underline;
}
#victoria-chat-rgpd-close {
	position: absolute;
	top: 4px;
	right: 6px;
	width: 18px;
	height: 18px;
	background: transparent;
	border: none;
	color: #888;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	border-radius: 3px;
	transition: background 0.15s ease, color 0.15s ease;
}
#victoria-chat-rgpd-close:hover {
	background: #e5e7eb;
	color: #333;
}

/* ============================================
   MESSAGES
   ============================================ */
#victoria-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f8f9fb;
	scroll-behavior: smooth;
}
.victoria-message {
	margin-bottom: 12px;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	animation: victoria-fade-in 0.25s ease;
}
.victoria-message.user {
	justify-content: flex-end;
}
.victoria-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	border: 1px solid #e5e7eb;
	background: #fff;
}
.victoria-message-bubble {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.victoria-message.user .victoria-message-bubble {
	background: var(--victoria-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.victoria-message.assistant .victoria-message-bubble {
	background: #fff;
	color: var(--victoria-text);
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
}
/* Liens dans les bulles : forcer la lisibilité contre les overrides du thème */
#victoria-chat-widget .victoria-message.user .victoria-message-bubble a,
#victoria-chat-widget .victoria-message.user .victoria-message-bubble a:link,
#victoria-chat-widget .victoria-message.user .victoria-message-bubble a:visited,
#victoria-chat-widget .victoria-message.user .victoria-message-bubble a:hover {
	color: #fff !important;
	text-decoration: underline !important;
	opacity: 0.95;
}
#victoria-chat-widget .victoria-message.assistant .victoria-message-bubble a,
#victoria-chat-widget .victoria-message.assistant .victoria-message-bubble a:link,
#victoria-chat-widget .victoria-message.assistant .victoria-message-bubble a:visited {
	color: var(--victoria-primary) !important;
	text-decoration: underline !important;
}
#victoria-chat-widget .victoria-message.assistant .victoria-message-bubble a:hover {
	color: var(--victoria-secondary) !important;
}
/* Code inline */
#victoria-chat-widget .victoria-message-bubble code {
	background: rgba(0, 0, 0, 0.07);
	padding: 1px 6px;
	border-radius: 3px;
	font-family: Consolas, Monaco, monospace;
	font-size: 0.92em;
}
#victoria-chat-widget .victoria-message.user .victoria-message-bubble code {
	background: rgba(255, 255, 255, 0.22);
	color: #fff;
}
/* Séparateur horizontal */
#victoria-chat-widget .victoria-message-bubble hr {
	border: 0;
	border-top: 1px solid rgba(0, 0, 0, 0.15);
	margin: 8px 0;
}
#victoria-chat-widget .victoria-message.user .victoria-message-bubble hr {
	border-top-color: rgba(255, 255, 255, 0.35);
}
.victoria-typing {
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
}
.victoria-typing span {
	width: 7px;
	height: 7px;
	background: var(--victoria-primary);
	border-radius: 50%;
	opacity: 0.4;
	animation: victoria-bounce 1.2s infinite;
}
.victoria-typing span:nth-child(2) { animation-delay: 0.15s; }
.victoria-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes victoria-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-5px); opacity: 1; }
}
@keyframes victoria-fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   SUGGESTIONS CLIQUABLES
   ============================================ */
#victoria-chat-suggestions-wrap {
	background: #f8f9fb;
}
#victoria-chat-suggestions-wrap.victoria-empty,
#victoria-chat-suggestions-wrap.victoria-hidden {
	display: none;
}
#victoria-chat-suggestions {
	padding: 0 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
#victoria-chat-suggestions:not(:empty) {
	padding-top: 6px;
}
.victoria-suggestion {
	background: #fff;
	border: 1px solid var(--victoria-primary);
	color: var(--victoria-primary);
	padding: 7px 12px;
	border-radius: 16px;
	font-size: 12.5px;
	line-height: 1.35;
	cursor: pointer;
	transition: all 0.15s ease;
	font-family: inherit;
	max-width: 100%;
	white-space: normal;
	text-align: left;
	word-wrap: break-word;
	overflow-wrap: break-word;
	hyphens: auto;
}
.victoria-suggestion:hover {
	background: var(--victoria-primary);
	color: #fff;
}
#victoria-chat-suggestions-hide {
	display: block;
	margin: 6px auto 8px auto;
	background: transparent;
	border: none;
	color: #888;
	font-size: 11px;
	cursor: pointer;
	padding: 2px 8px;
	font-family: inherit;
	text-decoration: underline;
	transition: color 0.15s ease;
}
#victoria-chat-suggestions-hide:hover {
	color: #333;
}
#victoria-chat-suggestions-wrap.victoria-empty #victoria-chat-suggestions-hide {
	display: none;
}

/* ============================================
   FORM
   ============================================ */
#victoria-chat-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	background: #fff;
	border-top: 1px solid #e5e7eb;
}
#victoria-chat-input {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 22px;
	padding: 10px 16px;
	font-size: 14px;
	color: var(--victoria-text);
	outline: none;
	transition: border-color 0.15s ease;
}
#victoria-chat-input:focus {
	border-color: var(--victoria-primary);
}
#victoria-chat-send {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: var(--victoria-primary);
	color: #fff;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}
#victoria-chat-send:hover {
	background: var(--victoria-secondary);
}
#victoria-chat-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

#victoria-chat-footer {
	text-align: center;
	font-size: 11px;
	color: #888;
	padding: 8px;
	background: #fff;
	border-top: 1px solid #f0f0f0;
}
#victoria-chat-footer a {
	color: var(--victoria-primary);
	text-decoration: none;
}
