/* Campusidyd Bot de Soporte — estilos del widget
   Paleta: verde azulado profundo (marca "educación/crecimiento") + acento ámbar
   reservado solo para la acción de escalar a WhatsApp. */

#csb-widget-root {
	--csb-primary: #1f6f5c;
	--csb-primary-dark: #15493d;
	--csb-accent: #e8a33d;
	--csb-accent-dark: #c9832a;
	--csb-bg-panel: #ffffff;
	--csb-bg-bot-bubble: #eef3f1;
	--csb-text: #1a2421;
	--csb-text-soft: #5c6864;
	--csb-border: #e2e7e4;
	--csb-shadow: 0 12px 32px rgba(20, 40, 35, 0.18);
	--csb-radius: 16px;

	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#csb-widget-root.csb-pos-right { right: 20px; }
#csb-widget-root.csb-pos-left  { left: 20px; }

/* ---------- Botón flotante ---------- */

.csb-fab {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--csb-primary);
	color: #ffffff;
	border: none;
	border-radius: 999px;
	padding: 14px 20px 14px 16px;
	box-shadow: var(--csb-shadow);
	cursor: pointer;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	transition: transform 0.15s ease, background 0.15s ease;
}

.csb-fab:hover { background: var(--csb-primary-dark); transform: translateY(-1px); }
.csb-fab:focus-visible { outline: 3px solid var(--csb-accent); outline-offset: 2px; }

.csb-fab-icon {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.csb-fab-dot {
	position: absolute;
	top: -3px;
	right: -3px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--csb-accent);
	border: 2px solid #ffffff;
}

/* ---------- Panel del chat ---------- */

.csb-panel {
	position: absolute;
	bottom: 68px;
	width: 340px;
	max-width: calc(100vw - 40px);
	max-height: 70vh; /* fallback para navegadores sin soporte de dvh */
	max-height: 70dvh;
	background: var(--csb-bg-panel);
	border-radius: var(--csb-radius);
	box-shadow: var(--csb-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	overscroll-behavior: contain;
	border: 1px solid var(--csb-border);
}

.csb-pos-right .csb-panel { right: 0; }
.csb-pos-left  .csb-panel { left: 0; }

.csb-panel[hidden] { display: none; }

.csb-header {
	background: var(--csb-primary);
	color: #ffffff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.csb-header-title {
	font-size: 15px;
	font-weight: 700;
	margin: 0;
}

.csb-header-sub {
	font-size: 12px;
	color: rgba(255, 255, 255, 0.75);
	margin: 2px 0 0;
}

.csb-close {
	background: transparent;
	border: none;
	color: #ffffff;
	opacity: 0.85;
	cursor: pointer;
	padding: 4px;
	line-height: 1;
	font-size: 20px;
}
.csb-close:hover { opacity: 1; }

.csb-body {
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #fbfbfa;
}

.csb-turn {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.csb-bubble {
	max-width: 88%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.45;
}

.csb-bubble-bot {
	background: var(--csb-bg-bot-bubble);
	color: var(--csb-text);
	border-bottom-left-radius: 4px;
	align-self: flex-start;
}

.csb-bubble-user {
	background: var(--csb-primary);
	color: #ffffff;
	border-bottom-right-radius: 4px;
	align-self: flex-end;
}

.csb-bubble a { color: inherit; text-decoration: underline; }

.csb-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 2px;
}

.csb-option-btn {
	text-align: left;
	background: #ffffff;
	border: 1.5px solid var(--csb-border);
	color: var(--csb-text);
	border-radius: 10px;
	padding: 9px 12px;
	font-size: 13.5px;
	font-weight: 500;
	cursor: pointer;
	transition: border-color 0.12s ease, background 0.12s ease;
}

.csb-option-btn:hover {
	border-color: var(--csb-primary);
	background: var(--csb-bg-bot-bubble);
}

.csb-option-btn:focus-visible {
	outline: 2px solid var(--csb-primary);
	outline-offset: 1px;
}

.csb-option-btn.csb-option-whatsapp,
.csb-option-btn.csb-option-accent {
	background: var(--csb-accent);
	border-color: var(--csb-accent);
	color: #2b1c05;
	font-weight: 700;
}

.csb-option-btn.csb-option-whatsapp:hover,
.csb-option-btn.csb-option-accent:hover {
	background: var(--csb-accent-dark);
	border-color: var(--csb-accent-dark);
}

/* Nota de aviso de privacidad al inicio de la conversación */
.csb-privacy {
	display: inline-block;
	margin-top: 6px;
	font-size: 12px;
	color: var(--csb-text-soft);
}

/* ---------- Campo de texto libre ---------- */

.csb-input-row {
	display: flex;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--csb-border);
	background: #ffffff;
}

.csb-input {
	flex: 1;
	border: 1.5px solid var(--csb-border);
	border-radius: 999px;
	padding: 9px 14px;
	font-size: 13.5px;
	color: var(--csb-text);
	font-family: inherit;
}

.csb-input:focus-visible {
	outline: none;
	border-color: var(--csb-primary);
}

.csb-input:disabled { background: #f3f4f2; color: var(--csb-text-soft); }

.csb-send {
	background: var(--csb-primary);
	color: #ffffff;
	border: none;
	border-radius: 999px;
	width: 38px;
	height: 38px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.csb-send:hover { background: var(--csb-primary-dark); }
.csb-send:disabled { background: var(--csb-border); cursor: default; }
.csb-send svg { width: 16px; height: 16px; }

.csb-bubble-loading {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}

.csb-bubble-loading span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--csb-text-soft);
	opacity: 0.5;
	animation: csb-blink 1.1s infinite ease-in-out;
}

.csb-bubble-loading span:nth-child(2) { animation-delay: 0.15s; }
.csb-bubble-loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes csb-blink {
	0%, 80%, 100% { opacity: 0.35; }
	40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.csb-bubble-loading span { animation: none; opacity: 0.7; }
}

.csb-footer {
	padding: 8px 16px 10px;
	border-top: 1px solid var(--csb-border);
	background: #ffffff;
}

.csb-restart {
	background: transparent;
	border: none;
	color: var(--csb-text-soft);
	font-size: 12px;
	cursor: pointer;
	padding: 4px 0;
}
.csb-restart:hover { color: var(--csb-text); text-decoration: underline; }

/* ---------- Responsive: bottom sheet en móvil ---------- */

@media (max-width: 480px) {
	#csb-widget-root { bottom: 12px; }
	#csb-widget-root.csb-pos-right { right: 12px; }
	#csb-widget-root.csb-pos-left { left: 12px; }

	.csb-panel {
		position: fixed;
		left: 10px;
		right: 10px;
		bottom: 78px;
		width: auto;
		max-width: none;
		max-height: 65vh; /* fallback para navegadores sin soporte de dvh */
		max-height: 65dvh;
	}
}

/* ---------- Accesibilidad: reducir movimiento ---------- */

@media (prefers-reduced-motion: reduce) {
	.csb-fab { transition: none; }
}
