/*!
 * com_fvtvchatbot widget styles
 * FuerteventuraTV — 2026
 */

#fvtv-chatbot-root {
	--fvtv-primary: #d97706;
	--fvtv-secondary: #0891b2;
	--fvtv-bg: #ffffff;
	--fvtv-bg-dark: #1f2937;
	--fvtv-text: #1f2937;
	--fvtv-muted: #6b7280;
	--fvtv-border: #e5e7eb;
	--fvtv-bubble-user: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
	--fvtv-bubble-ai: #f3f4f6;
	--fvtv-shadow: 0 12px 36px rgba(0, 0, 0, .18);
	--fvtv-radius: 18px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--fvtv-text);
	font-size: 14px;
	line-height: 1.45;
}

#fvtv-chatbot-root *,
#fvtv-chatbot-root *::before,
#fvtv-chatbot-root *::after {
	box-sizing: border-box;
}

.fvtv-toggle {
	position: fixed;
	bottom: 28px;
	width: 72px;
	height: 72px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--fvtv-primary) 0%, #c41a25 100%);
	color: #fff;
	font-size: 30px;
	cursor: pointer;
	box-shadow: var(--fvtv-shadow);
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .2s ease, box-shadow .2s ease;
	padding: 0;
}
.fvtv-toggle:hover { transform: scale(1.08); }
.fvtv-toggle:focus-visible { outline: 3px solid #1e3a8a; outline-offset: 3px; }
.fvtv-pos-right { right: 28px; }
.fvtv-pos-left  { left: 28px; }

.fvtv-chat {
	position: fixed;
	bottom: 100px;
	width: 390px;
	max-width: calc(100vw - 32px);
	height: 580px;
	max-height: calc(100vh - 120px);
	background: var(--fvtv-bg);
	border-radius: var(--fvtv-radius);
	box-shadow: var(--fvtv-shadow);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 9999;
	transform-origin: bottom right;
	animation: fvtvOpen .28s cubic-bezier(.34, 1.56, .64, 1);
}
.fvtv-pos-right + .fvtv-chat { right: 28px; }
.fvtv-pos-left + .fvtv-chat  { left: 28px;  transform-origin: bottom left; }
.fvtv-chat.open { display: flex; }

@keyframes fvtvOpen {
	from { transform: scale(.85); opacity: 0; }
	to   { transform: scale(1);   opacity: 1; }
}

.fvtv-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: linear-gradient(135deg, var(--fvtv-primary) 0%, var(--fvtv-secondary) 100%);
	color: #fff;
}
.fvtv-avatar {
	width: 40px; height: 40px;
	border-radius: 50%;
	background: rgba(255,255,255,.25);
	display: flex; align-items: center; justify-content: center;
	font-size: 18px;
}
.fvtv-title { flex: 1; min-width: 0; }
.fvtv-title strong { display:block; font-size: 14px; }
.fvtv-title small  { font-size: 11px; opacity: .85; }

.fvtv-lang {
	display: flex; gap: 4px;
}
.fvtv-lang button {
	background: rgba(255,255,255,.18);
	color: #fff;
	border: 0;
	padding: 4px 8px;
	border-radius: 6px;
	font-size: 11px;
	cursor: pointer;
	font-weight: 600;
}
.fvtv-lang button.active { background: #fff; color: var(--fvtv-primary); }
.fvtv-lang button:focus-visible { outline: 2px solid #fff; }

.fvtv-news {
	background: #fef3c7;
	color: #92400e;
	font-size: 12px;
	padding: 8px 14px;
	overflow: hidden;
	white-space: nowrap;
	position: relative;
}
.fvtv-news-track {
	display: inline-block;
	padding-left: 100%;
	animation: fvtvTicker 60s linear infinite;
}
.fvtv-news a { color: inherit; text-decoration: none; margin-right: 28px; }
@keyframes fvtvTicker {
	0%   { transform: translateX(0); }
	100% { transform: translateX(-100%); }
}

.fvtv-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #fafafa;
}
.fvtv-msg {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 14px;
	word-wrap: break-word;
	overflow-wrap: break-word;
	white-space: pre-wrap;
}
.fvtv-msg.user {
	align-self: flex-end;
	background: var(--fvtv-bubble-user);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.fvtv-msg.ai {
	align-self: flex-start;
	background: var(--fvtv-bubble-ai);
	color: var(--fvtv-text);
	border-bottom-left-radius: 4px;
}
.fvtv-msg.error {
	align-self: flex-start;
	background: #fee2e2;
	color: #991b1b;
	border-bottom-left-radius: 4px;
}
.fvtv-msg.thinking {
	color: var(--fvtv-muted);
	font-style: italic;
}
.fvtv-msg a {
	color: inherit;
	text-decoration: underline;
}

.fvtv-qr {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 6px;
}
.fvtv-qr button {
	background: #fff;
	border: 1px solid var(--fvtv-border);
	border-radius: 14px;
	padding: 6px 11px;
	font-size: 12px;
	cursor: pointer;
	color: var(--fvtv-text);
	transition: background .15s ease, border-color .15s ease;
}
.fvtv-qr button:hover { background: #fef3c7; border-color: var(--fvtv-primary); }
.fvtv-qr button:focus-visible { outline: 2px solid var(--fvtv-primary); }

.fvtv-input {
	display: flex;
	gap: 6px;
	padding: 10px 12px;
	border-top: 1px solid var(--fvtv-border);
	background: #fff;
}
.fvtv-input textarea {
	flex: 1;
	border: 1px solid var(--fvtv-border);
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	min-height: 36px;
	max-height: 100px;
	outline: none;
	color: var(--fvtv-text);
	background: #fff;
}
.fvtv-input textarea:focus { border-color: var(--fvtv-primary); }
.fvtv-input button {
	background: var(--fvtv-primary);
	color: #fff;
	border: 0;
	border-radius: 10px;
	padding: 0 14px;
	cursor: pointer;
	font-weight: 600;
}
.fvtv-input button:disabled {
	background: var(--fvtv-muted);
	cursor: not-allowed;
}
.fvtv-input button:focus-visible { outline: 2px solid #1e3a8a; outline-offset: 2px; }

.fvtv-footer {
	padding: 6px 14px;
	font-size: 11px;
	color: var(--fvtv-muted);
	text-align: center;
	border-top: 1px solid var(--fvtv-border);
	background: #fafafa;
}

/* Typing indicator */
.fvtv-dots span {
	display: inline-block;
	width: 6px; height: 6px; margin: 0 1px;
	background: var(--fvtv-muted);
	border-radius: 50%;
	animation: fvtvDots 1.2s infinite;
}
.fvtv-dots span:nth-child(2) { animation-delay: .15s; }
.fvtv-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes fvtvDots {
	0%, 60%, 100% { transform: translateY(0); opacity: .3; }
	30%           { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 480px) {
	.fvtv-chat {
		right: 16px !important;
		left: 16px !important;
		width: calc(100vw - 32px);
		bottom: 90px;
	}
	.fvtv-pos-right, .fvtv-pos-left { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.fvtv-chat, .fvtv-toggle, .fvtv-news-track, .fvtv-dots span {
		animation: none !important;
		transition: none !important;
	}
}

/* Language selector dropdown (replaces the EN/IT/ES buttons for the 11-language edition) */
.fvtv-lang-select {
	background: rgba(255,255,255,.18);
	color: #fff;
	border: 1px solid rgba(255,255,255,.35);
	border-radius: 6px;
	padding: 4px 6px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	max-width: 130px;
	appearance: none;
	-webkit-appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%);
	background-position: calc(100% - 12px) center, calc(100% - 8px) center;
	background-size: 4px 4px, 4px 4px;
	background-repeat: no-repeat;
	padding-right: 22px;
}
.fvtv-lang-select option {
	color: #1f2937;
	background: #fff;
}
.fvtv-lang-select:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Enhanced typing indicator (replaces the basic 3-dot loop) */
.fvtv-msg.thinking {
	background: linear-gradient(110deg, #f3f4f6 30%, #fef3c7 50%, #f3f4f6 70%);
	background-size: 200% 100%;
	animation: fvtvShimmer 1.6s ease-in-out infinite;
}
.fvtv-dots span {
	width: 7px;
	height: 7px;
	background: linear-gradient(135deg, var(--fvtv-primary), var(--fvtv-secondary));
	margin: 0 2px;
}
@keyframes fvtvShimmer {
	0%   { background-position: -100% 0; }
	100% { background-position:  100% 0; }
}

/* Genie lamp SVG icon inside the toggle button + header avatar */
.fvtv-toggle svg {
	width: 56px;
	height: 56px;
	display: block;
	background: #fff;
	border-radius: 50%;
	padding: 4px;
	box-sizing: border-box;
}
.fvtv-avatar svg {
	width: 30px;
	height: 30px;
	display: block;
	background: #fff;
	border-radius: 50%;
	padding: 2px;
	box-sizing: border-box;
}
.fvtv-toggle.open-state {
	font-size: 32px;
}

/* FVTV brand logo inside button and header avatar */
.fvtv-toggle .fvtv-logo {
	width: 42px;
	height: 42px;
	object-fit: contain;
	display: block;
	background: #fff;
	border-radius: 50%;
	padding: 3px;
}
.fvtv-avatar .fvtv-logo {
	width: 28px;
	height: 28px;
	object-fit: contain;
	display: block;
	background: #fff;
	border-radius: 50%;
}
