html, body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
:root {
    --primary: #2980b9;
    --primary-dark: #1f6698;
    --primary-light: rgba(41, 128, 185, 0.1);
    --primary-shadow: rgba(41, 128, 185, 0.3);
    --bg-light: #f8fafd;
    --border: #eee;
    --text: #333;
    --text-light: #888;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    --message-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    --bot-message-shadow: 0 3px 12px rgba(41, 128, 185, 0.25);
    --max-widget-height: 450px;
    --header-height: 52px;
    --footer-height: 61px;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background: transparent;
}
/* Solo posicionamiento para el lottie-player */
#chat-widget-button {
    position: fixed;
    bottom: 160px !important;
    right: 100px;
    z-index: 1001;
    display: none;
    cursor: pointer;
    width: 200px !important;
    height: 200px !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}
.floating-btn {
    animation: float 3s ease-in-out infinite;
    transition: all 0.3s ease;
}
@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-18px); }
    100% { transform: translateY(0); }
}
#chat-widget-button::before {
    display: none !important;
    content: none !important;
}
#chat-widget-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    max-height: var(--max-widget-height);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    animation: widgetEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes widgetEntrance {
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}
#chat-widget-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: var(--header-height);
    gap: 12px;
}
.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.header-icon svg {
    width: 20px;
    height: 20px;
}
#chat-widget-header span {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    flex: 1;
    text-align: center;
    padding: 0 8px;
}
.header-controls {
    display: flex;
    align-items: center;
}
.btn-spacer {
    width: 8px;
}
.header-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.3s ease;
    border: none;
}
.audio-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
}
.audio-btn::before {
    content: '🔊';
}
.audio-btn.muted::before {
    content: '🔇';
}
.close-btn {
    background: rgba(255, 99, 71, 0.3);
    color: white;
}
.close-btn:hover {
    background: rgba(255, 99, 71, 0.5);
    transform: rotate(90deg) scale(1.1);
}
.header-btn:hover {
    transform: scale(1.15);
}
#chat-widget-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    min-height: 50px;
}
.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 16px;
    line-height: 1.4;
    position: relative;
    animation: messageFade 0.3s ease-out;
    word-wrap: break-word;
}
@keyframes messageFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.user-message {
    background: white;
    color: var(--text);
    align-self: flex-end;
    box-shadow: var(--message-shadow);
    border-bottom-right-radius: 3px;
    transform: translateZ(0);
}
.bot-message {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    align-self: flex-start;
    box-shadow: var(--bot-message-shadow);
    border-bottom-left-radius: 3px;
    transform: translateZ(0);
}
.message::before {
    content: '';
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 8px;
}
.user-message::before {
    right: -4px;
    border-radius: 0 0 0 8px;
    box-shadow: -4px 4px 0 white;
}
.bot-message::before {
    left: -4px;
    border-radius: 0 0 8px 0;
    box-shadow: 4px 4px 0 var(--primary-dark);
}
#chat-widget-footer {
    padding: 12px;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    height: var(--footer-height);
}
#chat-widget-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 13px;
    transition: all 0.2s ease;
    background: var(--bg-light);
}
#chat-widget-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* --- botones de imagen --- */
#chat-widget-footer button img {
    width: 34px;
    height: 34px;
    display: block;
    margin: auto;
    pointer-events: none;
}

::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(41, 128, 185, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(41, 128, 185, 0.4);
}
.timestamp {
    font-size: 9px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}
.typing-indicator {
    display: flex;
    gap: 3px;
    padding: 4px 0;
}
.typing-dot {
    width: 5px;
    height: 5px;
    background: rgba(55, 255, 255, 0.7);
    border-radius: 50%;
    animation: typingAnimation 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}
.tts-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.tts-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 10px;
    transition: all 0.2s ease;
}
.tts-button:hover {
    background: rgba(255, 255, 255, 0.3);
}
.tts-button::before {
    content: '🔊';
}
.tts-button.playing::before {
    content: '⏸';
}

/* --- Fix visual de iconos en la cabecera del widget --- */
#chat-widget-header .header-btn {
    background: none !important;
    border: none !important;
    color: rgb(241, 2, 2) !important;
    font-size: 20px !important;
    box-shadow: none !important;
}
#chat-widget-header .audio-btn::before {
    content: '🔊';
    font-size: 20px;
}
#chat-widget-header .audio-btn.muted::before {
    content: '🔇';
    font-size: 20px;
}
#chat-widget-header .close-btn {
    font-size: 14px !important;
} 

/* --- Fix para evitar que Elementor afecte los botones del widget --- */
#chat-widget-container button,
#chat-widget-container .header-btn,
#chat-widget-container .audio-btn,
#chat-widget-container .close-btn {
    all: unset;
    display: inline-block;
    background: none !important;
    border: none !important;
    color: rgb(155, 155, 155) !important;
    font-size: 20px !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-width: unset !important;
    min-height: unset !important;
    line-height: 1 !important;
    cursor: pointer;
} 

/* Eliminar pseudo-elementos y fondo de los botones de micrófono y enviar */
#chat-widget-send::before,
#chat-widget-voice::before {
    display: none !important;
    content: none !important;
}
#chat-widget-footer > button#chat-widget-send,
#chat-widget-footer > button#chat-widget-voice {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: inherit !important;
    padding: 0 !important;
} 
#chat-widget-footer > button#chat-widget-send,
#chat-widget-footer > button#chat-widget-voice {
    margin-left: 2px !important;
    margin-right: 2px !important;
} 

