/* ---------- Widget de estado "En línea" ---------- */
.chat-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #7dbf01;
    box-shadow: 0 0 0 0 rgba(125, 191, 1, 0.6);
    animation: chat-pulse 2s infinite;
}

@keyframes chat-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(125, 191, 1, 0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(125, 191, 1, 0); }
    100% { box-shadow: 0 0 0 0 rgba(125, 191, 1, 0); }
}

/* ---------- Contenedor principal del chat ---------- */
.chat-shell {
    display: flex;
    flex-direction: column;
    background-color: #FFF;
    overflow: hidden;
}

.chat-shell-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background-color: #1d0938;
    color: #FFF;
    flex-shrink: 0;
}

.chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.chat-shell-header-info {
    flex-grow: 1;
    min-width: 0;
}

.chat-shell-header-info h2 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.chat-shell-header-info p {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #D1D5DB;
    margin-top: 2px;
}

.chat-whatsapp-fallback {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFF;
    border-radius: 50px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.chat-whatsapp-fallback:hover {
    background-color: #25d366;
}

/* ---------- Zona de mensajes ---------- */
.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: #F9FAFB;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #D1D5DB;
    border-radius: 10px;
}

.chat-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

.chat-msg-row.bot {
    align-self: flex-start;
}

.chat-msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #1d0938;
    flex-shrink: 0;
}

.chat-msg-avatar img {
    width: 14px;
    height: 14px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-msg-row.bot .chat-bubble {
    background-color: #FFF;
    color: #111827;
    border: 1px solid #E5E7EB;
    border-bottom-left-radius: 4px;
}

.chat-msg-row.user .chat-bubble {
    background-color: #7dbf01;
    color: #0d1a02;
    border-bottom-right-radius: 4px;
}

.chat-msg-row.error .chat-bubble {
    background-color: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.chat-msg-time {
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-msg-row.user .chat-msg-time {
    text-align: right;
}

/* ---------- Indicador de "escribiendo" ---------- */
.chat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.chat-typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #9CA3AF;
    animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Chips de sugerencias ---------- */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 18px;
    background-color: #FFF;
    border-top: 1px solid #F3F4F6;
    flex-shrink: 0;
}

.chat-suggestions.hidden {
    display: none;
}

.chat-chip {
    background-color: #EAE8F2;
    color: #1d0938;
    border: none;
    border-radius: 50px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chat-chip:hover {
    background-color: #d9d5e8;
}

/* ---------- Barra de entrada de texto ---------- */
.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 18px;
    background-color: #FFF;
    border-top: 1px solid #F3F4F6;
    flex-shrink: 0;
}

.chat-input {
    flex-grow: 1;
    resize: none;
    max-height: 120px;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    color: #111827;
    background-color: #F9FAFB;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #7dbf01;
    background-color: #FFF;
}

.chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #1d0938;
    color: #FFF;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.chat-send-btn:hover {
    background-color: #7dbf01;
    color: #0d1a02;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-disclaimer {
    text-align: center;
    font-size: 11px;
    color: #9CA3AF;
    padding: 8px 18px 0;
}

@media screen and (max-width: 640px) {
    .chat-msg-row {
        max-width: 92%;
    }
}
