/* SCOPED CSS: Estilos aislados bajo #lh-chat-widget-root */
#lh-chat-widget-root {
	/* Identidad Corporativa L'H */
	--lh-red:  #9B0F2F;       
	--lh-red-dark: #7d0c26;  
	--lh-dark: #333333;      
	--lh-gray: #666666; 
	--lh-green: #236012; 
	--lh-green-bg:#d8fbd5;
	--lh-light-bg: #f4f6f9;
	--lh-border: #e1e1e1;    
	--lh-shadow: 0 8px 15px rgba(0,0,0,0.2);
	--lh-font: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
	
	font-family: var(--lh-font);
	position: fixed;
	bottom: 1.5rem;
	right: 1rem;
	z-index: 999999;
	display: flex;
	flex-direction: row;
	align-items: center;
	line-height: 1.5;
	color: var(--lh-dark);
	font-size: 16px;
}

#lh-chat-widget-root * {
	box-sizing: border-box;
}

/* --- BOTÓN FLOTANTE (LAUNCHER) --- */
.lh-widget-launcher {
	width: 50px;
	height: 50px;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;            
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27), background 0.3s;
	
}
.lh-widget-launcher:hover {
	transform: scale(1.08);
}

.lh-widget-launcher img {
	width: 100%;
	
}

.lh-widget-launcher.hidden {
	display: none;
}

/* --- ETIQUETA DE INVITACIÓN --- */
.lh-widget-label-external {
	background: white;
    padding: .4rem;
    border-radius: .5rem;
    box-shadow:2px 2px 10px rgba(0, 0, 0, 0.4);
    margin-bottom: 0;
    margin-right: .5rem;
    font-size: .9rem;
    border: 1px solid var(--lh-border);
    display: none;
    flex-direction: column;
    animation: lh-fadeIn 0.4s ease;
    position: relative;
    cursor: pointer;
}

.lh-widget-label-external::after {
	content: '';
    position: absolute;
    bottom: 20px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: white;
    border-top: 1px solid var(--lh-border);
    border-right: 1px solid var(--lh-border);
    transform: rotate(45deg);
}

.lh-widget-label-external.visible { display: flex; }
.lh-widget-label-external strong { color: var(--lh-red); display: block; margin-bottom: 2px; }

/* --- VENTANA DEL CHAT --- */
.lh-widget-window {
	width: 380px;
	height: 650px;
	max-height: 80vh;
	max-width: calc(100vw - 20px);
	background-color: #fff;
	border-radius: .5rem;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: var(--lh-shadow);
	border: 1px solid var(--lh-border);            
	opacity: 0;
	pointer-events: none;
	transform: translateY(20px) scale(0.98);
	transition: opacity 0.25s ease, transform 0.25s ease;
	position: absolute;
	bottom: 0;
	right: 0;
}

.lh-widget-window.active {
	opacity: 1;
	pointer-events: all;
	transform: translateY(0) scale(1);
}

/* CABECERA */
.lh-widget-header {
	padding: .5rem 1rem; 
	background:var(--lh-red);
	border-bottom: 1px solid var(--lh-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.lh-header-left {
	display: flex;
	align-items: center;
	gap: 1rem; 
}

.lh-header-icon {
	width: 2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	color:white;
	flex-shrink: 0;
}


.lh-header-text h3 {
	font-size: 1.2rem;
	font-weight: 700;
	color:white;
	margin: 0;
	line-height: 1.2;
	
}
.lh-header-text span {
	font-size: .8rem;
	color:white;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-family:'Roboto Condensed', 'Segoe UI', Helvetica, Arial, sans-serif;
}

.lh-header-close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	color: var(--lh-border);
	border-radius: 50%;
	display: flex;
	transition: background 0.2s;
}
.lh-header-close:hover {
	background: var(--lh-light-bg);
	color: var(--lh-red);
}

/* CUERPO MENSAJES */
.lh-chat-body {
	flex: 1;
	overflow-y: auto;
	padding: 1rem; 
	display: flex;
	flex-direction: column;
	gap: 1rem; 
	background-color: #fff;
}

/* MENSAJES */
.lh-msg-row {
	display: flex;
	width: 100%;
	align-items: flex-start; 
}

/* ALINEACIÓN */
.lh-msg-row.bot { 
   justify-content: space-between;
   gap: 1rem; /* Espacio entre icono y burbuja */
}

.lh-msg-row.user { 
	justify-content: flex-end; 
}

/* Avatar Bot en mensaje */
.lh-bot-avatar-small {
	width: 30px; 
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0; 
	margin-top: 0px; 
}

/* --- BOMBOLLES (BUBBLES) --- */
.lh-msg-bubble {
	width: 100%;
	padding: .6rem 1rem;
	border-radius: .5rem;
	font-size: .9rem;
	line-height: 1.6;
	position: relative;
	word-wrap: break-word;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


.lh-msg-row.bot .lh-msg-bubble {
	background-color: var(--lh-light-bg);
	color: var(--lh-dark);
}

.lh-msg-row.bot .lh-msg-bubble::before {
	content: '';
	position: absolute;
	top: 12px;
	left: -8px;
	width: 12px;
	height: 12px;
	background-color: var(--lh-light-bg);
	border-bottom: 1px solid var(--lh-border);
	transform: rotate(45deg);
	}

.lh-msg-row.user .lh-msg-bubble {
	background-color: var(--lh-red);
	color: white;
	border-bottom-right-radius:0;
	width:auto;		
}


/* LISTAS EN MENSAJES */
.lh-msg-list {
	margin: 10px 0 10px 20px;
	padding: 0;
	list-style-type: disc;
}

.lh-msg-list li { margin-bottom: 6px; }
.lh-msg-rel {
	margin-top: .8rem;
	font-size: 0.8rem;
	color: #666;
	border-top: 1px solid #e3e3e3;
	padding-top: .5rem;
	align-items: center;
	justify-content: flex-start;
	display: flex;
	flex-direction: row;
}
.lh-msg-rel img { width:10px; margin-right:.3rem;}

/* BOTONES DE OPCIÓN (Chips) */
.lh-options-container {
	display: flex;
	flex-direction: column;
	gap: .8rem;
	width: 100%;
}

.lh-option-btn {
	background: white;
	border: 2px solid var(--lh-dark);
	color: var(--lh-dark);
	/* PADDING EXTRA en opcions també */
	padding: .8rem 1rem;
	border-radius: .5rem;
	text-align: left;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s;
	line-height: 1.4;
	box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.lh-option-btn:hover {
	border-color: var(--lh-red);
	color: var(--lh-red);
	background: #fffbfb;
	transform: translateX(2px);
}

.lh-option-btn.selected {
	background: var(--lh-red);
	border: 2px solid var(--lh-red);
	color: white;
    padding: .8rem 1rem;
    border-radius: .5rem;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* FOOTER DE OPCIÓN */
.lh-options-footer {
	font-size: .8rem;
	color: #888;
	text-align: right;
	margin-top: 4px;
	padding-right: 4px;
}

/* FEEDBACK */
.lh-feedback-box {
	background: white;
	border: 1px solid var(--lh-border);
	padding: .5rem 1rem; /* També més padding aquí */
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-radius: .8rem;
	font-size: .8rem;
	color: var(--lh-dark);
}
.lh-feedback-btns {
	justify-content: space-between;
	align-items: center;
	justify-content: space-between;
    align-items: center;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
	gap: .8rem;
    margin-left: .8rem;
	}
.lh-feedback-btns button {
	background: none;
	border: none;
	cursor: pointer;
	width: 25px;
	height: 25px;
	padding:0;
	opacity: 0.6;
	transition: opacity 0.2s, transform 0.2s;
}
.lh-feedback-btns button.lh-feedback-btn-si {background:url(/img/common/ico_si.svg); background-size:contain; background-repeat:no-repeat; margin-bottom: .4rem;}
.lh-feedback-btns button.lh-feedback-btn-no {background:url(/img/common/ico_no.svg); background-size:contain; background-repeat:no-repeat; margin-top: .4rem;}

.lh-feedback-btns button:hover {
	opacity: 1;
	transform: scale(1.2);
}

/* LOADING ANIMATION */
.lh-loader {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 8px 0;
	width:auto;
}
.lh-dot {
	width: 8px;
	height: 8px;
	margin: 0 4px;
	background-color: var(--lh-red);
	border-radius: 50%;
	animation: lh-bounce 1.4s infinite ease-in-out both;
}
.lh-dot:nth-child(1) { animation-delay: -0.32s; }
.lh-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes lh-bounce {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}
@keyframes lh-fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* FOOTER INPUT */
.lh-widget-footer {
	padding: .8rem 1rem;
	border-top: 1px solid var(--lh-border);
	display: flex;
	gap: .8rem;
	background: white;
	align-items: center;
	justify-content: space-between;
}

.lh-chat-input {
	flex: 1;
	padding: .7rem 1rem;
	border: 1px solid #ccc;
	border-radius: .5rem;
	font-size: 15px;
	outline: none;
	transition: border-color 0.2s;
	font-family: inherit;
}
.lh-chat-input:focus {
	border-color: var(--lh-red);
	box-shadow: 0 0 0 2px rgba(214, 0, 28, 0.1);
}

.lh-send-btn {
	width: 48px;
	height: 48px;
	background: white;
	border: 1px solid var(--lh-border);
	color: var(--lh-red);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s;
	flex-shrink: 0;
}
.lh-send-btn:hover {
	background: #fef2f2;
}
.lh-send-btn svg {
	width: 24px;
	height: 24px;
	fill: var(--lh-red);
	margin-left: 2px; 
}

/* Scrollbar Fina */
.lh-chat-body::-webkit-scrollbar { width: 6px; }
.lh-chat-body::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; }

/* dispositivos pequeños (landscape smartphones, 576px para arriba)*/
@media (min-width: 576px) { 
#lh-chat-widget-root {
	/* Identidad Corporativa L'H */
	--lh-red:  #9B0F2F;       
	--lh-red-dark: #7d0c26;  
	--lh-dark: #333333;      
	--lh-gray: #666666;  
	--lh-green: #236012; 
	--lh-green-bg:#d8fbd5;    
	--lh-light-bg: #f4f6f9;
	--lh-border: #e1e1e1;    
	--lh-shadow: 0 8px 24px rgba(0,0,0,0.2);
	--lh-font: 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
	
	font-family: var(--lh-font);
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	line-height: 1.5;
	color: var(--lh-dark);
	font-size: 16px;
}

.lh-widget-launcher {
	width: 80px;
	height: 80px;
	
}

.lh-widget-label-external {
	background: white;
	padding: 1rem;
	border-radius: .5rem;
	box-shadow: 0 4px 16px rgba(0,0,0,0.1);
	margin-bottom: 1rem;
	margin-right: .8rem;
	font-size: .9rem;
	border: 1px solid var(--lh-border);
	display: none;
	flex-direction: column;
	animation: lh-fadeIn 0.4s ease;
	position: relative;
	cursor: pointer;
	}
	
.lh-widget-label-external strong::after { content:'';}
.lh-widget-label-external span::before {padding-right:0}
	
.lh-widget-label-external::after {
	content: '';
	position: absolute;
	bottom: -6px;
	right: 24px;
	width: 12px;
	height: 12px;
	background: white;
	border-top: 0;
	border-bottom: 1px solid var(--lh-border);
	border-right: 1px solid var(--lh-border);
	transform: rotate(45deg);
}


}