/* Department Live Chat - Widget frontend (sin AJAX) */

.dlc-widget {
	position: fixed;
	bottom: 24px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.dlc-widget--right { right: 24px; }
.dlc-widget--left { left: 24px; }

/* ---------- Burbuja flotante ----------
 * El fondo sólido va en el propio botón y con !important para que ningún tema
 * (Elementor, Astra, Divi...) lo pise y deje transparentes los logos PNG. */
#dlc-widget .dlc-launcher {
	display: flex !important;
	align-items: center;
	flex-direction: row;
	height: 60px;
	min-height: 60px;
	width: auto;
	padding: 0 !important;
	margin: 0;
	box-sizing: border-box;
	border: none !important;
	border-radius: 30px !important;
	background: var(--dlc-launcher-bg, #2271b1) !important;
	background-color: var(--dlc-launcher-bg, #2271b1) !important;
	color: var(--dlc-launcher-text, #fff) !important;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	overflow: hidden;
	-webkit-appearance: none;
	appearance: none;
	text-transform: none;
	letter-spacing: normal;
}

/* Mensaje que aparece al pasar el ratón: la burbuja se ensancha lo justo para que quepa
 * el texto completo (si es largo, pasa a varias líneas en lugar de cortarse). */
.dlc-launcher__label {
	display: block;
	max-width: 0;
	overflow: hidden;
	flex: 0 0 auto;
	transition: max-width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.dlc-launcher__label-inner { display: block; }
.dlc-launcher__label-text {
	display: block;
	width: max-content;
	max-width: 240px;
	padding: 0 6px 0 22px;
	white-space: normal;
	text-align: left;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	opacity: 0;
	transform: translateX(10px);
	transition: opacity 0.25s ease 0.1s, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.05s;
}
#dlc-widget .dlc-launcher:hover .dlc-launcher__label,
#dlc-widget .dlc-launcher:focus-visible .dlc-launcher__label {
	max-width: 270px;
}
#dlc-widget .dlc-launcher:hover .dlc-launcher__label-text,
#dlc-widget .dlc-launcher:focus-visible .dlc-launcher__label-text {
	opacity: 1;
	transform: none;
}

/* Con la burbuja a la izquierda de la pantalla, el mensaje va tras el icono. */
.dlc-widget--left .dlc-launcher { flex-direction: row-reverse; }
.dlc-widget--left .dlc-launcher__label-text { padding: 0 22px 0 6px; transform: translateX(-10px); }

/* Panel abierto: la burbuja vuelve a ser solo un círculo. */
.dlc-widget.is-open .dlc-launcher__label { display: none; }

.dlc-launcher__circle {
	position: relative;
	width: 60px;
	height: 60px;
	flex: 0 0 60px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--dlc-launcher-bg, #2271b1) !important;
	display: flex;
	align-items: center;
	justify-content: center;
}
.dlc-launcher__icon-open,
.dlc-launcher__icon-close {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.dlc-launcher__icon-open img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 0;
	background: transparent;
}
.dlc-launcher__icon-open { opacity: 1; transform: none; }
.dlc-launcher__icon-close { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.dlc-widget.is-open .dlc-launcher__icon-open { opacity: 0; transform: rotate(90deg) scale(0.5); }
.dlc-widget.is-open .dlc-launcher__icon-close { opacity: 1; transform: none; }

/* ---------- Panel ---------- */
.dlc-panel {
	position: absolute;
	bottom: 74px;
	width: 340px;
	max-width: calc(100vw - 32px);
	height: 480px;
	max-height: 70vh;
	background: var(--dlc-panel-bg, #fff);
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;

	/* Cerrado: invisible y no interactivo (visibility evita que reciba foco). */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(18px) scale(0.92);
	transition: opacity 0.22s ease, transform 0.28s ease, visibility 0s linear 0.28s;
}
.dlc-widget--right .dlc-panel { right: 0; transform-origin: bottom right; }
.dlc-widget--left .dlc-panel { left: 0; transform-origin: bottom left; }
.dlc-widget.is-open .dlc-panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: none;
	transition: opacity 0.25s ease, transform 0.38s cubic-bezier(0.34, 1.4, 0.64, 1), visibility 0s;
}

/* Cambio de vista (departamentos <-> conversación): entrada suave. */
.dlc-view { animation: dlc-view-in 0.3s ease both; }
@keyframes dlc-view-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}
.dlc-department-bubbles .dlc-department-bubble-btn { animation: dlc-view-in 0.35s ease both; }
.dlc-department-bubbles .dlc-department-bubble-btn:nth-child(2) { animation-delay: 0.05s; }
.dlc-department-bubbles .dlc-department-bubble-btn:nth-child(3) { animation-delay: 0.1s; }
.dlc-department-bubbles .dlc-department-bubble-btn:nth-child(4) { animation-delay: 0.15s; }
.dlc-department-bubbles .dlc-department-bubble-btn:nth-child(n+5) { animation-delay: 0.2s; }

.dlc-panel__header {
	background: var(--dlc-header-bg, #2271b1);
	color: var(--dlc-header-text, #fff);
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 15px;
}
.dlc-panel__header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlc-panel__logo { width: 28px; height: 28px; min-width: 28px; border-radius: 50%; object-fit: cover; background: #fff; }
.dlc-panel__header-left strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlc-panel__close {
	background: transparent !important;
	border: none !important;
	color: var(--dlc-header-text, #fff) !important;
	font-size: 16px;
	cursor: pointer;
	opacity: 0.85;
	padding: 0;
}

.dlc-panel__body { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.dlc-welcome { margin: 0 0 12px; color: #3c434a; font-size: 13px; }
.dlc-departments-logo { display: block; width: 48px; height: 48px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; }
.dlc-loading { color: #8c8f94; font-size: 13px; margin: 0; }

.dlc-department-bubbles { display: flex; flex-direction: column; gap: 8px; }
a.dlc-department-bubble-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #e2e4e7;
	background: #fff;
	cursor: pointer;
	text-align: left;
	text-decoration: none;
	box-shadow: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}
a.dlc-department-bubble-btn:hover { background: #f7f8fa; border-color: var(--dlc-accent, #2271b1); }
.dlc-department-bubble-btn__icon {
	width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	font-size: 16px; color: #fff;
}
.dlc-department-bubble-btn__text strong { display: block; font-size: 13px; color: #1d2327; }
.dlc-department-bubble-btn__text span { font-size: 11px; color: #8c8f94; }

.dlc-back {
	background: none !important;
	border: none !important;
	color: var(--dlc-accent, #2271b1) !important;
	font-size: 12px;
	cursor: pointer;
	padding: 0 0 10px;
	text-align: left;
	box-shadow: none;
}

/* Vista del iframe */
.dlc-view--frame { padding: 0; }
.dlc-view--frame .dlc-back { padding: 12px 16px 6px; }
.dlc-frame-iframe { flex: 1; width: 100%; border: 0; background: transparent; min-height: 0; }

@media (max-width: 480px) {
	.dlc-panel { width: calc(100vw - 24px); height: 60vh; }
	/* En móvil no hay hover: la burbuja se queda en círculo. */
	.dlc-launcher__label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.dlc-panel, .dlc-launcher__label, .dlc-launcher__label-text,
	.dlc-launcher__icon-open, .dlc-launcher__icon-close { transition-duration: 0.01s !important; transition-delay: 0s !important; }
	.dlc-view, .dlc-department-bubbles .dlc-department-bubble-btn { animation: none !important; }
}
