/* DWVisual Asistente Web — brand tokens aligned with dwvisual-child */
.dwv-asistente {
	--dwv-violet: var(--violet, #3d4166);
	--dwv-violet-deep: #282b47;
	--dwv-orange: var(--orange, #f28c28);
	--dwv-paper: var(--paper, #f2f2f2);
	--dwv-white: var(--white, #fff);
	--dwv-line: var(--line, rgba(61, 65, 102, 0.16));
	--dwv-ink: var(--ink, #333);
	--dwv-shadow: 0 24px 70px rgba(61, 65, 102, 0.14);
	font-family: inherit;
	color: var(--dwv-violet);
}

.dwv-asistente[hidden] { display: none !important; }

.dwv-asistente__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(61, 65, 102, 0.28);
	z-index: 120;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.dwv-asistente.is-open .dwv-asistente__backdrop { opacity: 1; }

.dwv-asistente__panel {
	position: fixed;
	right: 24px;
	bottom: 104px;
	z-index: 121;
	width: min(392px, calc(100vw - 24px));
	max-height: min(520px, calc(100vh - 112px));
	display: flex;
	flex-direction: column;
	background: var(--dwv-white);
	border: 1px solid var(--dwv-line);
	box-shadow: var(--dwv-shadow);
	border-radius: 16px;
	overflow: hidden;
	transform: translateY(12px);
	opacity: 0;
	transition: opacity 0.28s ease, transform 0.28s cubic-bezier(.22,.8,.22,1);
}

.dwv-asistente.is-open .dwv-asistente__panel {
	opacity: 1;
	transform: none;
}

.dwv-asistente__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px 8px;
	background: linear-gradient(135deg, #3d4166 0%, #4a5078 55%, #3d4166 100%);
	color: #fff;
	border-bottom: 2px solid var(--dwv-orange);
	flex: 0 0 auto;
}

.dwv-asistente__avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--dwv-orange);
	flex: 0 0 36px;
	background: #fff;
}

.dwv-asistente__brand {
	flex: 1;
	min-width: 0;
	line-height: 1.2;
}

.dwv-asistente__brand strong {
	display: block;
	font-size: 0.88rem;
	font-weight: 700;
}

.dwv-asistente__brand span {
	display: block;
	font-size: 0.68rem;
	opacity: 0.88;
	font-weight: 400;
}

.dwv-asistente__close {
	appearance: none;
	border: 0;
	background: rgba(255,255,255,0.12);
	color: #fff;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1.15rem;
	line-height: 1;
	flex: 0 0 34px;
}

.dwv-asistente__close:focus-visible {
	outline: 2px solid var(--dwv-orange);
	outline-offset: 2px;
}

.dwv-asistente__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 10px 12px 4px;
	background:
		radial-gradient(120% 80% at 100% 0%, rgba(242, 140, 40, 0.08), transparent 55%),
		linear-gradient(180deg, #fafafa 0%, #fff 40%);
	-webkit-overflow-scrolling: touch;
}

.dwv-asistente__msg {
	background: linear-gradient(145deg, var(--dwv-violet-deep) 0%, var(--dwv-violet) 100%);
	border: 0;
	border-radius: 12px 12px 12px 4px;
	padding: 10px 12px;
	font-size: 0.88rem;
	font-weight: 500;
	line-height: 1.4;
	margin: 0 0 8px;
	color: #fff;
	box-shadow: 0 6px 16px rgba(40, 43, 71, 0.2);
	opacity: 1;
	transform: none;
}

.dwv-asistente__msg.is-appear {
	animation: dwv-msg-in 0.38s cubic-bezier(.22,.8,.22,1) both;
}

.dwv-asistente__msg p { margin: 0 0 0.45em; color: inherit; }
.dwv-asistente__msg p:last-child { margin-bottom: 0; }

.dwv-asistente__msg ul {
	margin: 0.35em 0 0;
	padding-left: 1.1em;
	color: inherit;
}

.dwv-asistente__msg a {
	color: #ffd7a8;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.dwv-asistente__msg strong {
	color: #fff;
	font-weight: 700;
}

/* Typing indicator while bot “writes” */
.dwv-asistente__typing {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: linear-gradient(145deg, var(--dwv-violet-deep) 0%, var(--dwv-violet) 100%);
	border-radius: 12px 12px 12px 4px;
	padding: 12px 14px;
	margin: 0 0 8px;
	box-shadow: 0 6px 16px rgba(40, 43, 71, 0.18);
	min-height: 38px;
}

.dwv-asistente__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	animation: dwv-dot-bounce 1.05s ease-in-out infinite;
}

.dwv-asistente__typing span:nth-child(2) { animation-delay: 0.15s; }
.dwv-asistente__typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dwv-dot-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
	30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes dwv-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

@keyframes dwv-opts-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.dwv-asistente__typing span { animation: none; opacity: 0.85; }
	.dwv-asistente__msg.is-appear,
	.dwv-asistente__options.is-appear {
		animation: none;
	}
}

.dwv-asistente__context {
	font-size: 0.7rem;
	line-height: 1.35;
	color: #6f6e85;
	margin: -2px 0 8px;
	padding: 0 2px;
}

.dwv-asistente__options {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin: 0 0 6px;
}

.dwv-asistente__options.is-appear {
	animation: dwv-opts-in 0.42s 0.08s cubic-bezier(.22,.8,.22,1) both;
}

.dwv-asistente__btn {
	appearance: none;
	width: 100%;
	min-height: 36px;
	text-align: left;
	padding: 7px 11px;
	border-radius: 10px;
	border: 1px solid rgba(61, 65, 102, 0.18);
	background: rgba(255, 255, 255, 0.92);
	color: var(--dwv-violet);
	font: inherit;
	font-size: 0.8rem;
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
	box-shadow: none;
	transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dwv-asistente__btn:hover {
	border-color: var(--dwv-orange);
	background: #fff8f0;
}

.dwv-asistente__btn:focus-visible {
	outline: 2px solid var(--dwv-orange);
	outline-offset: 2px;
}

.dwv-asistente__btn--primary {
	background: var(--dwv-violet);
	border-color: var(--dwv-violet);
	color: #fff;
}

.dwv-asistente__btn--primary:hover {
	background: #33375a;
	border-color: #33375a;
	color: #fff;
}

.dwv-asistente__btn--whatsapp {
	background: #fff;
	border: 2px solid var(--dwv-orange);
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none !important;
	color: var(--dwv-violet) !important;
	min-height: 44px;
	padding: 8px 11px;
}

.dwv-asistente__btn--whatsapp img {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--dwv-orange);
	flex: 0 0 32px;
}

.dwv-asistente__btn--whatsapp span {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}

.dwv-asistente__btn--whatsapp small {
	font-size: 0.7rem;
	font-weight: 500;
	color: #6f6e85;
}

.dwv-asistente__footer {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: space-between;
	gap: 2px;
	padding: 5px 8px 6px;
	border-top: 1px solid var(--dwv-line);
	background: var(--dwv-paper);
	flex: 0 0 auto;
}

.dwv-asistente__linkbtn {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--dwv-violet);
	font: inherit;
	font-size: 0.7rem;
	font-weight: 600;
	min-height: 30px;
	padding: 4px 5px;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
}

.dwv-asistente__linkbtn:focus-visible {
	outline: 2px solid var(--dwv-orange);
	outline-offset: 2px;
	border-radius: 6px;
}

.dwv-asistente__search {
	display: flex;
	gap: 6px;
	margin: 0 0 8px;
}

.dwv-asistente__search input {
	flex: 1;
	min-height: 36px;
	border: 1px solid var(--dwv-line);
	border-radius: 10px;
	padding: 6px 10px;
	font: inherit;
	font-size: 0.82rem;
	color: var(--dwv-ink);
	background: #fff;
}

.dwv-asistente__search button {
	min-width: 40px;
	min-height: 36px;
	border-radius: 10px;
	border: 1px solid var(--dwv-violet);
	background: var(--dwv-violet);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.dwv-asistente__notice {
	font-size: 0.74rem;
	line-height: 1.35;
	color: #6f6e85;
	margin: 0 0 8px;
	padding: 8px 10px;
	border-left: 3px solid var(--dwv-orange);
	background: #fff8f0;
}

.dwv-asistente__chip {
	display: inline-block;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--dwv-orange);
	margin-bottom: 4px;
}

/* Keep theme FAB clickable while panel open; lift above footer */
body.dwv-asistente-open .dw-whatsapp-fab,
body.dwv-asistente-open .whatsapp-orbit {
	z-index: 122;
}

body.dwv-asistente-open .whatsapp-message {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

@media (max-width: 720px) {
	.dwv-asistente__panel {
		right: 0;
		left: 0;
		bottom: 0;
		width: 100%;
		max-width: none;
		max-height: min(82vh, 560px);
		border-radius: 16px 16px 0 0;
	}

	.dwv-asistente__footer {
		flex-wrap: wrap;
		justify-content: flex-start;
		gap: 2px 6px;
		padding: 6px 10px 8px;
	}

	.dwv-asistente__linkbtn {
		min-height: 36px;
		font-size: 0.74rem;
		padding: 6px 8px;
	}

	.dwv-asistente__btn {
		min-height: 40px;
		padding: 8px 12px;
	}

	.dwv-asistente__search input,
	.dwv-asistente__search button {
		min-height: 40px;
	}
}

/* Fallback FAB styles when theme bubble is absent */
.dwv-asistente-fallback-fab.whatsapp-orbit,
.dwv-asistente-fallback-fab.dw-whatsapp-fab {
	position: fixed;
	right: 25px;
	bottom: 25px;
	z-index: 90;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	padding: 0;
	background: transparent;
	border: 0;
	text-decoration: none !important;
	width: auto;
	max-width: min(220px, calc(100vw - 40px));
	pointer-events: none;
}
.dwv-asistente-fallback-fab i,
.dwv-asistente-fallback-fab .whatsapp-message {
	pointer-events: auto;
}
.dwv-asistente-fallback-fab i {
	width: 66px;
	height: 66px;
	display: grid;
	place-items: center;
	position: relative;
	border-radius: 50%;
	background: #3d4166;
	color: #fff;
	box-shadow: 0 12px 36px rgba(61, 65, 102, 0.28);
	border: 2px solid #f28c28;
}
.dwv-asistente-fallback-fab i svg { stroke: #fff; fill: none; }
.dwv-asistente-fallback-fab .whatsapp-message {
	padding: 11px 14px;
	background: #fff;
	border: 1px solid var(--line, rgba(61, 65, 102, 0.16));
	box-shadow: 0 18px 50px rgba(61, 65, 102, 0.08);
	color: var(--violet, #3d4166);
	font-size: 11px;
	font-weight: 400;
	white-space: nowrap;
}
@media (max-width: 720px) {
	.dwv-asistente-fallback-fab .whatsapp-message { display: none; }
	.dwv-asistente-fallback-fab { right: 16px; bottom: 16px; }
	.dwv-asistente-fallback-fab i { width: 58px; height: 58px; }
}

/* Live human-attended mode */
.dwv-asistente__live {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-height: 100%;
}
.dwv-asistente__live-banner {
	padding: 12px;
	border-radius: 12px;
	background: linear-gradient(135deg, #e8f8ef, #f7fff9);
	border: 1px solid rgba(37, 211, 102, 0.35);
}
.dwv-asistente__live-banner p {
	margin: 0 0 10px;
	font-size: 0.9rem;
	color: var(--dwv-violet-deep);
}
.dwv-asistente__live-banner .dwv-asistente__btn--whatsapp {
	width: 100%;
	justify-content: center;
}
.dwv-asistente__live-thread {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 340px;
	overflow: auto;
	padding-right: 2px;
}
.dwv-asistente__live-msg {
	max-width: 92%;
	padding: 8px 10px;
	border-radius: 12px;
	font-size: 0.9rem;
	line-height: 1.35;
}
.dwv-asistente__live-msg p {
	margin: 0.2rem 0 0;
}
.dwv-asistente__live-who {
	display: block;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	opacity: 0.75;
}
.dwv-asistente__live-msg.is-human {
	align-self: flex-start;
	background: linear-gradient(145deg, #282b47, #3d4166);
	color: #fff;
}
.dwv-asistente__live-msg.is-visitor {
	align-self: flex-end;
	background: #e8f1fb;
	color: var(--dwv-violet-deep);
}
.dwv-asistente__live-msg.is-system {
	align-self: center;
	background: #fff8e5;
	color: #646970;
	font-size: 0.8rem;
}
.dwv-asistente__live-form {
	display: flex;
	gap: 8px;
	width: 100%;
	margin-bottom: 6px;
}
.dwv-asistente__live-form input {
	flex: 1;
	min-width: 0;
	border: 1px solid var(--dwv-line);
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
}
.dwv-asistente__live-form .dwv-asistente__btn {
	flex: 0 0 auto;
	padding: 10px 14px;
}
.dwv-asistente .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}
