:root {
	--miha-accent: #0f766e;
	--miha-accent2: #0b4f49;
	--miha-btn-bg: #0f766e;
	--miha-btn-text: #ffffff;
	--miha-hbtn-bg: #ffffff;
	--miha-hbtn-text: #0f766e;
	--miha-bottom: 20px;
	--miha-bubble-bg: #0f766e;
}

.miha-app {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: #1f2937;
}

.miha-app button {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

/* ===== Globo flotante (redondo, con etiqueta) ===== */
.miha-bubble-wrap {
	position: fixed;
	right: 20px;
	bottom: var(--miha-bottom);
	display: flex;
	align-items: center;
	gap: 10px;
	z-index: 999999;
}

.miha-pos-left .miha-bubble-wrap {
	left: 20px;
	right: auto;
	flex-direction: row-reverse;
}

.miha-bubble-label {
	background: #fff;
	color: #1f2937;
	padding: 10px 16px;
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
}

.miha-bubble {
	width: 62px;
	height: 62px;
	aspect-ratio: 1 / 1;
	border: none;
	border-radius: 50%;
	background: var(--miha-bubble-bg);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	overflow: hidden;
	flex: 0 0 auto;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.miha-bubble svg {
	width: 28px;
	height: 28px;
	display: block;
}

.miha-bubble img {
	width: 68%;
	height: 68%;
	object-fit: contain;
	display: block;
}

.miha-bubble:hover {
	transform: scale(1.07);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

/* ===== Panel ===== */
.miha-panel {
	position: fixed;
	right: 20px;
	bottom: calc(var(--miha-bottom) + 74px);
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - var(--miha-bottom) - 90px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 20px;
	overflow: hidden;
	z-index: 999999;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.miha-pos-left .miha-panel {
	left: 20px;
	right: auto;
}

.miha-embed .miha-panel {
	position: static;
	width: 100%;
	max-width: 420px;
	height: 560px;
	margin: 0 auto;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* ===== Minimizar ===== */
.miha-panel.miha-minimized {
	height: auto;
}

.miha-panel.miha-minimized .miha-welcome,
.miha-panel.miha-minimized .miha-lead,
.miha-panel.miha-minimized .miha-messages,
.miha-panel.miha-minimized .miha-inputrow {
	display: none !important;
}

/* ===== Header (franja de la conversación) ===== */
.miha-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: linear-gradient(135deg, var(--miha-accent), var(--miha-accent2));
	color: #fff;
	flex: 0 0 auto;
}

.miha-logo {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	object-position: center top;
	flex: 0 0 42px;
}

.miha-heading {
	flex: 1;
	min-width: 0;
}

.miha-name {
	font-weight: 700;
	font-size: 16px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.miha-status {
	font-size: 12px;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 5px;
}

.miha-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80;
	display: inline-block;
}

.miha-head-btns {
	display: flex;
	gap: 5px;
}

.miha-icon-btn {
	background: var(--miha-hbtn-bg) !important;
	border: none;
	color: var(--miha-hbtn-text) !important;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}

.miha-icon-btn:hover {
	opacity: 0.85;
}

/* ===== Pantalla de bienvenida (sin header) ===== */
.miha-welcome {
	flex: 1;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 24px;
	text-align: center;
	background: #fff;
}

.miha-welcome-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.08);
	color: #374151;
	cursor: pointer;
	font-size: 15px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.miha-embed .miha-welcome-close {
	display: none;
}

.miha-welcome-logo {
	height: 60%;
	min-height: 220px;
	max-height: 360px;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.miha-welcome-logo img {
	max-height: 100%;
	max-width: 92%;
	object-fit: contain;
	animation: mihaFloat 3.2s ease-in-out infinite;
}

.miha-welcome-text {
	font-size: 15px;
	color: #374151;
}

.miha-btn-start {
	background: var(--miha-btn-bg) !important;
	color: var(--miha-btn-text) !important;
	border: none;
	border-radius: 999px;
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.miha-btn-start:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

@keyframes mihaFloat {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-6px); }
}

/* ===== Mensajes ===== */
.miha-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	background: #f3f4f6;
	display: flex;
	flex-direction: column;
}

.miha-msg {
	display: flex;
	margin-bottom: 10px;
}

.miha-msg-bot {
	justify-content: flex-start;
}

.miha-msg-user {
	justify-content: flex-end;
}

.miha-bubble-inner {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 20px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

.miha-msg-bot .miha-bubble-inner {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 8px;
}

.miha-msg-user .miha-bubble-inner {
	background: linear-gradient(135deg, var(--miha-accent), var(--miha-accent2));
	color: #fff;
	border-bottom-right-radius: 8px;
}

.miha-bubble-inner a {
	color: var(--miha-accent);
	text-decoration: underline;
}

.miha-msg-user .miha-bubble-inner a {
	color: #fff;
}

/* ===== Botones / chips ===== */
.miha-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0 14px 12px;
	background: #f3f4f6;
}

.miha-chip {
	border: 1px solid var(--miha-btn-bg);
	color: var(--miha-btn-bg);
	background: #fff;
	border-radius: 999px;
	padding: 8px 14px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.miha-chip:hover {
	background: var(--miha-btn-bg) !important;
	color: var(--miha-btn-text) !important;
}

.miha-link-btn {
	display: block;
	width: 100%;
	box-sizing: border-box;
	margin: 10px 0 0;
	padding: 10px;
	text-align: center;
	background: var(--miha-btn-bg) !important;
	color: var(--miha-btn-text) !important;
	border-radius: 14px;
	text-decoration: none !important;
	font-weight: 600;
	font-size: 13px;
}

.miha-link-btn:hover {
	filter: brightness(0.95);
	color: var(--miha-btn-text) !important;
}

/* ===== Indicador escribiendo ===== */
.miha-typing .miha-bubble-inner {
	display: flex;
	gap: 5px;
	align-items: center;
}

.miha-typing .miha-bubble-inner span {
	width: 7px;
	height: 7px;
	background: #9ca3af;
	border-radius: 50%;
	display: inline-block;
	animation: mihaBlink 1.2s infinite ease-in-out;
}

.miha-typing .miha-bubble-inner span:nth-child(2) { animation-delay: 0.2s; }
.miha-typing .miha-bubble-inner span:nth-child(3) { animation-delay: 0.4s; }

@keyframes mihaBlink {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

/* ===== Input ===== */
.miha-inputrow {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #e5e7eb;
	background: #fff;
	flex: 0 0 auto;
}

.miha-inputrow input {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	padding: 10px 16px;
	font-size: 16px;
	outline: none;
}

.miha-inputrow input:focus {
	border-color: var(--miha-accent);
}

.miha-btn-primary {
	background: var(--miha-btn-bg) !important;
	color: var(--miha-btn-text) !important;
	border: none;
	border-radius: 50%;
	width: 42px;
	height: 42px;
	flex: 0 0 42px;
	cursor: pointer;
	font-size: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.miha-btn-primary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ===== Formulario de datos ===== */
.miha-lead {
	padding: 16px;
	display: none;
	background: #fff;
	flex: 1;
}

.miha-lead-title {
	font-weight: 700;
	margin-bottom: 10px;
	font-size: 15px;
}

.miha-lead input {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	padding: 12px 16px;
	margin-bottom: 10px;
	font-size: 16px;
	outline: none;
}

.miha-lead input:focus {
	border-color: var(--miha-accent);
}

.miha-lead .miha-btn-primary {
	width: 100%;
	border-radius: 20px;
	height: auto;
	padding: 12px;
	font-size: 14px;
}

/* ===== Glassmorphism ===== */
.miha-glass .miha-panel {
	background: rgba(255, 255, 255, 0.68);
	backdrop-filter: blur(18px) saturate(160%);
	-webkit-backdrop-filter: blur(18px) saturate(160%);
	border: 1px solid rgba(255, 255, 255, 0.55);
}

.miha-glass .miha-header {
	background: linear-gradient(135deg, var(--miha-accent), var(--miha-accent2));
}

.miha-glass .miha-messages,
.miha-glass .miha-buttons,
.miha-glass .miha-welcome {
	background: transparent;
}

.miha-glass .miha-msg-bot .miha-bubble-inner {
	background: rgba(255, 255, 255, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.6);
}

.miha-glass .miha-inputrow {
	background: rgba(255, 255, 255, 0.55);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.miha-glass .miha-bubble {
	background: var(--miha-bubble-bg);
	backdrop-filter: blur(10px) saturate(150%);
	-webkit-backdrop-filter: blur(10px) saturate(150%);
	border: 1px solid rgba(255, 255, 255, 0.4);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
	.miha-panel {
		right: 10px;
		left: 10px;
		bottom: calc(var(--miha-bottom) + 74px);
		width: auto;
	}
	.miha-bubble-wrap {
		right: 14px;
	}
	.miha-pos-left .miha-bubble-wrap {
		left: 14px;
		right: auto;
	}
	.miha-welcome-logo {
		height: 50%;
		min-height: 140px;
		max-height: 260px;
	}
	.miha-embed .miha-panel {
		height: 480px;
	}
}
