/* AI Chat Assistant - WhatsApp-like Widget */
#aica-chat-container {
    --aica-primary: #25D366;
    --aica-secondary: #075E54;
    --aica-user-bubble: #DCF8C6;
    --aica-bot-bubble: #FFFFFF;
    --aica-text: #303030;
    --aica-header-bg: #075E54;
    --aica-window-width: 380px;
    --aica-window-height: 550px;
    /* v4.1.2: tokens unificados de radii (consistencia con admin) */
    --aica-radius-xs: 4px;
    --aica-radius-sm: 6px;
    --aica-radius:    10px;
    --aica-radius-lg: 16px;
    --aica-radius-pill: 999px;
    --aica-easing: cubic-bezier(.4, 0, .2, 1);
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    box-sizing: border-box;
}
#aica-chat-container *,
#aica-chat-container *::before,
#aica-chat-container *::after {
    box-sizing: border-box;
}

/* Position */
#aica-chat-container.aica-bottom-right {
    bottom: 20px;
    right: 20px;
}
#aica-chat-container.aica-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* === BUBBLE BUTTON === */
#aica-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--aica-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    outline: none;
}
#aica-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
#aica-chat-bubble:active {
    transform: scale(0.95);
}
.aica-bubble-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* === CHAT WINDOW === */
#aica-chat-window {
    position: absolute;
    bottom: 75px;
    width: var(--aica-window-width);
    height: var(--aica-window-height);
    background: #E5DDD5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    animation: aica-slide-up 0.3s ease;
}
#aica-chat-container.aica-bottom-right #aica-chat-window {
    right: 0;
}
#aica-chat-container.aica-bottom-left #aica-chat-window {
    left: 0;
}

@keyframes aica-slide-up {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* WhatsApp background pattern */
#aica-chat-window::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #E5DDD5;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9c9c9' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: 0;
    pointer-events: none;
}

/* === HEADER === */
.aica-chat-header {
    background: var(--aica-header-bg);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
    min-height: 60px;
}
.aica-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
}
.aica-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.aica-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.aica-header-name {
    font-weight: 600;
    font-size: 15px;
}
.aica-header-status {
    font-size: 12px;
    opacity: 0.85;
}
.aica-header-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    outline: none;
}
.aica-header-close:hover { opacity: 1; }

/* === CHAT BODY === */
.aica-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    position: relative;
    z-index: 1;
    scroll-behavior: smooth;
}
.aica-chat-body::-webkit-scrollbar { width: 5px; }
.aica-chat-body::-webkit-scrollbar-track { background: transparent; }
.aica-chat-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }

/* === MESSAGES === */
.aica-messages-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aica-message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
    animation: aica-msg-in 0.2s ease;
    line-height: 1.6;
}
.aica-message strong {
    font-weight: 700;
    color: inherit;
}
.aica-br-spacer {
    display: block;
    height: 10px;
    content: "";
}
@keyframes aica-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bot message (left) */
.aica-message.aica-bot {
    background: var(--aica-bot-bubble);
    color: var(--aica-text);
    align-self: flex-start;
    border-top-left-radius: 2px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.aica-message.aica-bot::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    border-width: 0 8px 8px 0;
    border-style: solid;
    border-color: transparent var(--aica-bot-bubble) transparent transparent;
}

/* User message (right, green) */
.aica-message.aica-user {
    background: var(--aica-user-bubble);
    color: var(--aica-text);
    align-self: flex-end;
    border-top-right-radius: 2px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.aica-message.aica-user::before {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    border-width: 0 0 8px 8px;
    border-style: solid;
    border-color: transparent transparent transparent var(--aica-user-bubble);
}

/* Message time + check */
.aica-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 3px;
}
.aica-message-time {
    font-size: 11px;
    color: #999;
}
.aica-read-checks {
    display: inline-flex;
    color: #53bdeb;
    font-size: 14px;
    line-height: 1;
}
.aica-read-checks.aica-sent { color: #999; }

/* === TYPING INDICATOR === */
.aica-typing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 8px;
}
.aica-typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.aica-typing-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.aica-typing-bubble {
    background: var(--aica-bot-bubble);
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    gap: 4px;
    align-items: center;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.aica-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: aica-bounce 1.4s infinite ease-in-out;
}
.aica-dot:nth-child(1) { animation-delay: -0.32s; }
.aica-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes aica-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* === QUICK REPLIES === */
.aica-quick-replies-bar {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    background: rgba(255,255,255,0.9);
    border-top: 1px solid #e0e0e0;
    position: relative;
    z-index: 1;
    scrollbar-width: none;
}
.aica-quick-replies-bar::-webkit-scrollbar { display: none; }
.aica-quick-reply-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 18px;
    border: 1px solid var(--aica-primary);
    background: white;
    color: var(--aica-primary);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.aica-quick-reply-btn:hover {
    background: var(--aica-primary);
    color: white;
}

/* === PRODUCT CARDS === */
.aica-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 280px;
    margin: 8px 0;
    align-self: flex-start;
    animation: aica-msg-in 0.3s ease;
}
.aica-product-card-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}
.aica-product-card-body {
    padding: 12px;
}
.aica-product-card-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--aica-text);
}
.aica-product-card-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    /* `pre-line` colapsa espacios pero PRESERVA los \n del textarea de descripción.
       Así "✓ Punto 1\n✓ Punto 2" se muestra como dos líneas en la card.
       Sin esto los \n se renderizaban como simples espacios y todo el
       contenido quedaba en un solo párrafo corrido. */
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.aica-product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--aica-primary);
    margin-bottom: 10px;
}
.aica-product-card-cta {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--aica-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.2s;
}
.aica-product-card-cta:hover { opacity: 0.9; }

/* === LEAD FORM === */
.aica-lead-form {
    position: relative;
    z-index: 2;
}
.aica-lead-form-inner {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.aica-lead-title {
    font-weight: 600;
    font-size: 15px;
    margin: 0 0 16px 0;
    color: var(--aica-text);
    text-align: center;
}
.aica-lead-field {
    margin-bottom: 10px;
}
.aica-lead-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.aica-lead-field input:focus {
    border-color: var(--aica-primary);
}
/* Custom field inputs inside lead form (select + input inherit same style) */
.aica-lead-field .aica-lead-custom-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: white;
    color: var(--aica-text);
    -webkit-appearance: none;
    appearance: none;
}
.aica-lead-field .aica-lead-custom-input:focus {
    border-color: var(--aica-primary);
}
.aica-lead-btn {
    width: 100%;
    padding: 12px;
    background: var(--aica-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: opacity 0.2s;
}
.aica-lead-btn:hover { opacity: 0.9; }

/* === APPOINTMENT FORM === */
.aica-appointment-form {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    max-width: 280px;
    align-self: flex-start;
}
.aica-appointment-form h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--aica-secondary);
}
.aica-appointment-form input,
.aica-appointment-form select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 8px;
}
.aica-appointment-form button {
    width: 100%;
    padding: 10px;
    background: var(--aica-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* === FOOTER / INPUT === */
.aica-chat-footer {
    background: #f0f0f0;
    padding: 8px 12px;
    position: relative;
    z-index: 2;
}
.aica-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-radius: 24px;
    padding: 4px 8px 4px 16px;
}
#aica-input-field {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    padding: 8px 0;
    background: transparent;
    color: var(--aica-text);
}
#aica-input-field::placeholder { color: #999; }
#aica-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
#aica-send-button:hover { background: #f5f5f5; }

/* === MIC BUTTON === */
#aica-mic-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
    outline: none;
    padding: 0;
}
#aica-mic-button:hover {
    background: #f0f0f0;
    color: var(--aica-primary);
}
#aica-mic-button.aica-mic-recording {
    color: #e74c3c;
    animation: aica-mic-pulse 1.2s ease-in-out infinite;
}
@keyframes aica-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}

/* === DATE SEPARATOR === */
.aica-date-separator {
    text-align: center;
    margin: 16px 0 8px;
    position: relative;
}
.aica-date-separator span {
    background: rgba(225, 218, 208, 0.9);
    padding: 4px 14px;
    border-radius: 8px;
    font-size: 12px;
    color: #54656f;
    box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

/* === LINK STYLES in messages === */
.aica-message a {
    color: #039be5;
    text-decoration: underline;
}
.aica-message a:hover {
    color: #0277bd;
}

/* === v3.1.0: BADGE ANIMATIONS === */
@keyframes aica-badge-bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-5px);}
    60% {transform: translateY(-3px);}
}
@keyframes aica-badge-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
}
@keyframes aica-badge-swing {
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-10deg); }
    60% { transform: rotate(5deg); }
    80% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}
@keyframes aica-badge-flash {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0; }
}

.aica-badge-bounce { animation: aica-badge-bounce 2s infinite; }
.aica-badge-pulse { animation: aica-badge-pulse 2s infinite; }
.aica-badge-swing { animation: aica-badge-swing 2s infinite; transform-origin: top center; }
.aica-badge-flash { animation: aica-badge-flash 2s infinite; }

/* === v3.1.1: PRE-CHAT BUBBLE === */
.aica-prechat-bubble {
    position: absolute;
    bottom: 75px;
    background: white;
    padding: 12px 35px 12px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: 14px;
    color: var(--aica-text);
    white-space: nowrap;
    z-index: 1000;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    /* v4.1.2: easing estándar (antes era bouncy/poco profesional) */
    transition: opacity .28s var(--aica-easing), transform .28s var(--aica-easing);
}
.aica-prechat-visible { opacity: 1; transform: translateY(0); }
#aica-chat-container.aica-bottom-right .aica-prechat-bubble { right: 0; }
#aica-chat-container.aica-bottom-left .aica-prechat-bubble { left: 0; }

.aica-prechat-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    border-style: solid;
    border-width: 8px 8px 0 8px;
    border-color: white transparent transparent transparent;
}
#aica-chat-container.aica-bottom-right .aica-prechat-bubble::after { right: 22px; }
#aica-chat-container.aica-bottom-left .aica-prechat-bubble::after { left: 22px; }

.aica-prechat-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}
.aica-prechat-close:hover { color: #666; }

/* === v3.1.1: STARS RATING === */
.aica-rating-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.7);
    padding: 12px;
    margin: 10px 0;
    border-radius: 10px;
    align-self: center;
    text-align: center;
}
.aica-rating-label { font-size: 12px; color: #666; margin-bottom: 5px; }
.aica-stars { display: flex; gap: 5px; }
.aica-star {
    background: none;
    border: none;
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    padding: 0;
}
.aica-star:hover, .aica-star.hover, .aica-star.selected { color: #ffcc00; transform: scale(1.2); }

/* === TYPEWRITER CURSOR === */
.aica-cursor {
    display: inline-block;
    width: 2px;
    animation: aica-blink 0.8s infinite;
    margin-left: 2px;
}
@keyframes aica-blink { 50% { opacity: 0; } }

/* === Shake (usado por shakeElement() para validaciones fallidas) ===
   Se desactiva automáticamente cuando el sistema pide reducir animaciones. */
@keyframes aica-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80%      { transform: translateX(6px); }
}

/* === Badge "nuevo mensaje" cuando el usuario scrolleó arriba === */
.aica-new-msg-badge {
    position: absolute;
    right: 12px;
    bottom: 72px;
    background: var(--aica-primary, #25D366);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 4px;
    z-index: 2;
}
.aica-new-msg-badge:hover { transform: translateY(-2px); }

/* Respeta la preferencia del usuario (a11y) — desactiva animaciones molestas. */
@media (prefers-reduced-motion: reduce) {
    .aica-message,
    .aica-bubble-badge,
    .aica-prechat-bubble,
    #aica-chat-bubble,
    .aica-toast {
        animation: none !important;
        transition: none !important;
    }
}

/* === DARK MODE === */
#aica-chat-container.aica-dark #aica-chat-window { background: #0b141a; }
#aica-chat-container.aica-dark #aica-chat-window::before { opacity: 0.05; background-color: #0b141a; }
#aica-chat-container.aica-dark .aica-message.aica-bot { background: #202c33; color: #e9edef; }
#aica-chat-container.aica-dark .aica-message.aica-bot::before { border-color: transparent #202c33 transparent transparent; }
#aica-chat-container.aica-dark .aica-message.aica-user { background: #005c4b; color: #e9edef; }
#aica-chat-container.aica-dark .aica-message.aica-user::before { border-color: transparent transparent transparent #005c4b; }
#aica-chat-container.aica-dark .aica-message-time { color: rgba(233,237,239,0.6); }
#aica-chat-container.aica-dark .aica-chat-footer { background: #202c33; }
#aica-chat-container.aica-dark .aica-input-container { background: #2a3942; }
#aica-chat-container.aica-dark #aica-input-field { color: #e9edef; }
#aica-chat-container.aica-dark .aica-quick-replies-bar { background: #111b21; border-color: #2a3942; }
#aica-chat-container.aica-dark .aica-quick-reply-btn { background: #202c33; border-color: var(--aica-primary); }
#aica-chat-container.aica-dark .aica-product-card { background: #202c33; }
#aica-chat-container.aica-dark .aica-product-card-title { color: #e9edef; }
#aica-chat-container.aica-dark .aica-product-card-desc { color: #aebac1; }
#aica-chat-container.aica-dark #aica-mic-button { color: #aebac1; }
#aica-chat-container.aica-dark #aica-mic-button:hover { background: #2a3942; color: var(--aica-primary); }

/* === v4.1.2: TOAST in-chat (reemplaza alert) === */
.aica-toast {
    position: absolute;
    left: 50%;
    bottom: 70px;
    transform: translateX(-50%) translateY(8px);
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(20,20,20,0.92);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity .22s ease, transform .22s ease;
    z-index: 10;
    pointer-events: none;
}
.aica-toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.aica-toast-warning { background: #c77700; }
.aica-toast-error   { background: #c0392b; }
.aica-toast-success { background: #1e824c; }

/* === v4.1.2: Quick replies fade-right indicador de scroll === */
.aica-quick-replies-bar {
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
            mask-image: linear-gradient(to right, #000 85%, transparent);
}
/* Si no hay overflow (pocas replies) el usuario nunca ve el fade porque todo cabe. */

/* === v4.1.2: Outline visible para foco por teclado (a11y) === */
#aica-chat-container :focus-visible {
    outline: 2px solid var(--aica-primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* === v4.1.2: Responsive — móvil y soporte de teclado virtual === */
@media (max-width: 480px) {
    #aica-chat-container.aica-bottom-right,
    #aica-chat-container.aica-bottom-left {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    #aica-chat-window {
        /* usa todo el espacio disponible sin reventar en pantallas pequeñas */
        width: calc(100vw - 32px);
        max-width: var(--aica-window-width);
        /* 100dvh excluye el teclado virtual en navegadores modernos; fallback en vh */
        max-height: 80vh;
        max-height: 80dvh;
        bottom: 75px;
    }
    /* Cuando el input está enfocado, ocupa más alto: el OS reduce la viewport. */
    #aica-chat-window { height: min(var(--aica-window-height), 80dvh); }
    .aica-prechat-bubble { display: none; }
}

/* Respeta prefers-reduced-motion (a11y) */
@media (prefers-reduced-motion: reduce) {
    #aica-chat-window,
    .aica-message,
    .aica-prechat-bubble,
    .aica-toast,
    .aica-badge-bounce, .aica-badge-pulse, .aica-badge-swing, .aica-badge-flash {
        animation: none !important;
        transition: none !important;
    }
}
#aica-chat-container.aica-dark #aica-mic-button.aica-mic-recording { color: #e74c3c; }
