/* Ritz Valley Chatbot: scoped under #rvc-widget so theme styles do not leak in or out. */
#rvc-widget {
	--rvc-primary: #c9a45b;
	--rvc-primary-dark: #b38f4a;
	--rvc-header: #2c3e50;
	position: fixed;
	bottom: 90px;
	right: 30px;
	z-index: 99999;
	font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	color: #2c3e50;
}
#rvc-widget *, #rvc-widget *::before, #rvc-widget *::after { box-sizing: border-box; }
#rvc-widget [hidden] { display: none !important; }
#rvc-widget button { font-family: inherit; text-transform: none; letter-spacing: normal; margin: 0; }
#rvc-widget p { margin: 0; }

/* Launcher */
#rvc-widget .rvc-launcher {
	width: 60px; height: 60px; padding: 0;
	border-radius: 50%; border: none; outline: none;
	background: linear-gradient(135deg, var(--rvc-primary) 0%, var(--rvc-primary-dark) 100%);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 15px rgba(0, 0, 0, .2);
	transition: transform .3s ease, box-shadow .3s ease;
	animation: rvc-pulse 2s infinite;
}
#rvc-widget .rvc-launcher:hover { transform: scale(1.1); animation: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
#rvc-widget .rvc-launcher:focus-visible { outline: 3px solid var(--rvc-primary-dark); outline-offset: 3px; }
@keyframes rvc-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(201, 164, 91, .5); }
	70%  { box-shadow: 0 0 0 15px rgba(201, 164, 91, 0); }
	100% { box-shadow: 0 0 0 0 rgba(201, 164, 91, 0); }
}

/* Panel */
#rvc-widget .rvc-panel {
	position: absolute; bottom: 0; right: 0;
	width: 350px; height: 500px; max-height: calc(100vh - 120px);
	background: #fff; border-radius: 20px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
	display: flex; flex-direction: column; overflow: hidden;
	animation: rvc-slide .3s ease;
}
#rvc-widget.rvc-left .rvc-panel { right: auto; left: 0; }
@keyframes rvc-slide { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

#rvc-widget .rvc-header {
	background: linear-gradient(135deg, var(--rvc-header) 0%, #1a2632 100%);
	color: #fff; padding: 15px;
	display: flex; justify-content: space-between; align-items: center;
}
#rvc-widget .rvc-header-info { display: flex; align-items: center; gap: 10px; }
#rvc-widget .rvc-avatar {
	width: 40px; height: 40px; border-radius: 50%;
	background: var(--rvc-primary); color: #fff;
	display: flex; align-items: center; justify-content: center;
}
#rvc-widget .rvc-title { font-size: 16px; font-weight: 600; color: #fff; }
#rvc-widget .rvc-status { font-size: 12px; color: #4cd964; }
#rvc-widget .rvc-icon-btn {
	background: none; border: none; color: #fff; cursor: pointer;
	opacity: .8; padding: 6px; border-radius: 6px; line-height: 0;
}
#rvc-widget .rvc-icon-btn:hover { opacity: 1; background: rgba(255, 255, 255, .1); }

/* Messages */
#rvc-widget .rvc-messages {
	flex: 1; overflow-y: auto; padding: 15px;
	background: #f8f9fa;
	display: flex; flex-direction: column; gap: 10px;
}
#rvc-widget .rvc-msg { display: flex; flex-direction: column; }
#rvc-widget .rvc-bot { align-items: flex-start; }
#rvc-widget .rvc-user { align-items: flex-end; }
#rvc-widget .rvc-bubble {
	max-width: 85%; padding: 10px 14px; border-radius: 15px;
	font-size: 13px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere;
}
#rvc-widget .rvc-bot .rvc-bubble { background: #fff; border: 1px solid #e9ecef; border-bottom-left-radius: 5px; color: #2c3e50; }
#rvc-widget .rvc-user .rvc-bubble { background: var(--rvc-primary); color: #fff; border-bottom-right-radius: 5px; }
#rvc-widget .rvc-time { font-size: 10px; color: #999; margin-top: 4px; }

#rvc-widget .rvc-chips { display: flex; flex-wrap: wrap; gap: 6px; max-width: 90%; }
#rvc-widget .rvc-chip {
	background: #fff; border: 1px solid var(--rvc-primary); color: var(--rvc-primary-dark);
	border-radius: 14px; padding: 6px 10px; font-size: 12px; cursor: pointer; text-align: left; line-height: 1.3;
}
#rvc-widget .rvc-chip:hover { background: var(--rvc-primary); color: #fff; }

/* Lead form */
#rvc-widget .rvc-form { padding: 15px; background: #fff; border-top: 1px solid #e9ecef; display: flex; flex-direction: column; gap: 10px; }
#rvc-widget .rvc-field, #rvc-widget .rvc-input {
	width: 100%; margin: 0; padding: 10px 12px;
	border: 1px solid #ddd; border-radius: 8px; background: #fff; color: #2c3e50;
	font: inherit; font-size: 13px; box-shadow: none; height: auto;
}
#rvc-widget .rvc-field:focus, #rvc-widget .rvc-input:focus { outline: none; border-color: var(--rvc-primary); box-shadow: 0 0 0 2px rgba(201, 164, 91, .15); }
#rvc-widget .rvc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
#rvc-widget .rvc-error { color: #c0392b; font-size: 12px; min-height: 0; }
#rvc-widget .rvc-error:empty { display: none; }
#rvc-widget .rvc-submit {
	width: 100%; padding: 12px; border: none; border-radius: 8px;
	background: var(--rvc-primary); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer;
}
#rvc-widget .rvc-submit:hover { background: var(--rvc-primary-dark); }

/* Input */
#rvc-widget .rvc-input-area { padding: 12px 15px; background: #fff; border-top: 1px solid #e9ecef; }
#rvc-widget .rvc-input-row { display: flex; gap: 10px; align-items: center; margin: 0; }
#rvc-widget .rvc-input { flex: 1; border-radius: 25px; padding: 11px 14px; }
#rvc-widget .rvc-send {
	width: 40px; height: 40px; flex: 0 0 40px; padding: 0;
	border-radius: 50%; border: none; background: var(--rvc-primary); color: #fff;
	display: flex; align-items: center; justify-content: center; cursor: pointer;
	transition: transform .2s, background .2s;
}
#rvc-widget .rvc-send:hover:not(:disabled) { background: var(--rvc-primary-dark); transform: scale(1.08); }
#rvc-widget .rvc-send:disabled { background: #ccc; cursor: not-allowed; }

#rvc-widget .rvc-typing { display: flex; gap: 5px; padding: 4px 2px 10px; }
#rvc-widget .rvc-typing span {
	width: 8px; height: 8px; border-radius: 50%; background: var(--rvc-primary);
	animation: rvc-typing 1s infinite ease-in-out;
}
#rvc-widget .rvc-typing span:nth-child(2) { animation-delay: .2s; }
#rvc-widget .rvc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes rvc-typing { 0%, 60%, 100% { transform: none; opacity: .6; } 30% { transform: translateY(-5px); opacity: 1; } }

#rvc-widget .rvc-messages::-webkit-scrollbar { width: 5px; }
#rvc-widget .rvc-messages::-webkit-scrollbar-track { background: #f1f1f1; }
#rvc-widget .rvc-messages::-webkit-scrollbar-thumb { background: var(--rvc-primary); border-radius: 5px; }

/* Mobile */
@media (max-width: 768px) {
	#rvc-widget .rvc-launcher { width: 52px; height: 52px; }
}
@media (max-width: 480px) {
	#rvc-widget .rvc-panel {
		position: fixed; left: 12px; right: 12px; bottom: 12px;
		width: auto; height: min(520px, calc(100vh - 24px)); max-height: none;
	}
	#rvc-widget .rvc-field, #rvc-widget .rvc-input { font-size: 16px; } /* stops iOS zoom on focus */
}
@media (prefers-reduced-motion: reduce) {
	#rvc-widget .rvc-launcher, #rvc-widget .rvc-panel, #rvc-widget .rvc-typing span { animation: none; }
}
