/* ============================================================
   ChatVoz IDME — Estilos del widget de voz
   ============================================================ */

/* --- Botón flotante --- */
#chatvoz-floating-btn {
    position: fixed;
    bottom: 104px;
    right: 28px;
    z-index: 9998;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e63329;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s, background 0.2s;
    outline: none;
}

#chatvoz-floating-btn:hover {
    transform: scale(1.08);
    background: #c62c23;
}

#chatvoz-floating-btn svg {
    width: 30px;
    height: 30px;
    fill: #fff;
}

/* --- Panel principal --- */
#chatvoz-panel {
    position: fixed;
    bottom: 104px;
    right: 28px;
    z-index: 9999;
    width: 340px;
    max-height: 520px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #222;
}

/* --- Cabecera --- */
.chatvoz-header {
    background: #e63329;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.chatvoz-header__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chatvoz-header__info {
    flex: 1;
    min-width: 0;
}

.chatvoz-header__name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.chatvoz-header__status {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chatvoz-header__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.chatvoz-header__close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

/* --- Área de transcripción --- */
#chatvoz-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: #f8f8f8;
}

#chatvoz-transcript::-webkit-scrollbar {
    width: 4px;
}
#chatvoz-transcript::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* --- Turnos de conversación --- */
.chatvoz-turn {
    max-width: 88%;
    padding: 9px 13px;
    border-radius: 12px;
    line-height: 1.45;
    word-break: break-word;
}

.chatvoz-turn--assistant {
    background: #e63329;
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.chatvoz-turn--user {
    background: #fff;
    color: #222;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    border: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chatvoz-turn--system {
    align-self: center;
    background: transparent;
    color: #999;
    font-size: 12px;
    text-align: center;
    padding: 4px 8px;
}

/* Indicador "escribiendo..." */
.chatvoz-typing { align-items: center; }

.chatvoz-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    margin-left: 8px;
    vertical-align: middle;
}

.chatvoz-dots span {
    width: 7px;
    height: 7px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    animation: chatvoz-bounce 1.2s infinite;
}

.chatvoz-dots span:nth-child(2) { animation-delay: 0.2s; }
.chatvoz-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatvoz-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1;   }
}

.chatvoz-turn__name {
    font-weight: 700;
    font-size: 11px;
    display: block;
    margin-bottom: 3px;
    opacity: 0.8;
}

.chatvoz-turn--assistant .chatvoz-turn__name {
    color: rgba(255,255,255,0.85);
}

.chatvoz-turn--user .chatvoz-turn__name {
    color: #999;
    text-align: right;
}

/* --- Barra inferior --- */
.chatvoz-footer {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chatvoz-footer button {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s, opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

#chatvoz-btn-mute {
    background: #f0f0f0;
    color: #555;
}

#chatvoz-btn-mute:hover {
    background: #e0e0e0;
}

#chatvoz-btn-mute.chatvoz-muted {
    background: #fff3cd;
    color: #856404;
}

#chatvoz-btn-end {
    background: #e63329;
    color: #fff;
}

#chatvoz-btn-end:hover {
    background: #c62c23;
}

/* --- Animación de pulso cuando está activo --- */
@keyframes chatvoz-pulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(230,51,41,0.4); }
    50%       { box-shadow: 0 4px 24px rgba(230,51,41,0.7); }
}

#chatvoz-floating-btn.chatvoz-active {
    animation: chatvoz-pulse 1.8s ease-in-out infinite;
}

/* --- Burbuja de invitación --- */
#chatvoz-callout {
    position: fixed;
    bottom: 112px;
    right: 102px;
    background: #fff;
    border-radius: 12px;
    padding: 10px 32px 10px 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #222;
    line-height: 1.4;
    cursor: pointer;
    z-index: 9997;
    max-width: 190px;
    display: none;
    user-select: none;
}

/* Cola apuntando al botón flotante */
#chatvoz-callout::after {
    content: '';
    position: absolute;
    right: -9px;
    bottom: 18px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 9px solid #fff;
}

#chatvoz-callout-close {
    position: absolute;
    top: 6px;
    right: 7px;
    background: none;
    border: none;
    font-size: 16px;
    line-height: 1;
    color: #bbb;
    cursor: pointer;
    padding: 0;
}

#chatvoz-callout-close:hover {
    color: #666;
}

/* --- Selector de modo (voz / texto) --- */
#chatvoz-mode-picker {
    position: fixed;
    bottom: 180px;
    right: 28px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 9998;
}

#chatvoz-mode-picker button {
    background: #fff;
    border: 2px solid #e63329;
    color: #e63329;
    border-radius: 24px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

#chatvoz-mode-picker button:hover {
    background: #e63329;
    color: #fff;
}

/* --- Footer modo texto --- */
.chatvoz-footer--text {
    padding: 10px 12px;
}

.chatvoz-footer--text input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.chatvoz-footer--text input:focus {
    border-color: #e63329;
}

#chatvoz-btn-send {
    background: #e63329;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.15s;
}

#chatvoz-btn-send:hover {
    background: #c62c23;
}

#chatvoz-btn-end-text {
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#chatvoz-btn-end-text:hover {
    background: #e0e0e0;
}

/* --- Responsive: móvil --- */
@media (max-width: 480px) {
    #chatvoz-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 16px 16px 0 0;
    }

    #chatvoz-floating-btn {
        bottom: 100px;
        right: 20px;
        width: 52px;
        height: 52px;
    }

    #chatvoz-floating-btn svg {
        width: 24px;
        height: 24px;
    }

    #chatvoz-mode-picker {
        bottom: 162px;
        right: 20px;
    }

    #chatvoz-callout {
        bottom: 108px;
        right: 82px;
        max-width: 160px;
        font-size: 12px;
    }
}
