.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;

    width: 80px;
    height: 80px;

    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    padding: 0;
    margin: 0;

    display: flex;
    justify-content: center;
    align-items: center;

    cursor: pointer;
    z-index: 9999;
}

.chatbot-button img {
    display: block;
    width: 80px;
    height: 80px;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.chatbot-button .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ----- CONTENEDOR DEL CHAT ----- */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 400px;
    height: 580px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(26, 58, 47, 0.1);
    transition: all 0.3s ease;
}

.chatbot-container.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----- HEADER DEL CHAT ----- */
.chat-header {
    background: linear-gradient(135deg, #1a3a2f, #2d5a4a);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header .info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chat-header .title {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.chat-header .subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    margin-top: 2px;
}

.chat-header .status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header .status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chat-header .close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.chat-header .close-btn:hover {
    color: white;
}

/* ----- CUERPO DEL CHAT ----- */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-body::-webkit-scrollbar {
    width: 5px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #2d5a4a;
    border-radius: 10px;
}

/* ----- MENSAJES ----- */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.message.bot .pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1a3a2f, #2d5a4a);
    color: white;
    border-bottom-right-radius: 4px;
}

.message .timestamp {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
    text-align: right;
}

.message.user .timestamp {
    color: rgba(255, 255, 255, 0.7);
}

.message.bot .timestamp {
    color: #999;
}

.message .typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.message .typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2d5a4a;
    animation: typing 1.4s ease-in-out infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----- MENSAJES DE SISTEMA ----- */
.message.system {
    align-self: center;
    background: #fff3cd;
    color: #856404;
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 20px;
    max-width: 90%;
}

.message.error {
    align-self: center;
    background: #f8d7da;
    color: #721c24;
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 20px;
    max-width: 90%;
}

/* ----- FOOTER DEL CHAT ----- */
.chat-footer {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.chat-footer .input-wrapper {
    flex: 1;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-footer input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    background: #f8f9fa;
}

.chat-footer input:focus {
    border-color: #2d5a4a;
    background: white;
}

.chat-footer input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-footer .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #1a3a2f, #2d5a4a);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-footer .send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(26, 58, 47, 0.3);
}

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

/* ----- OPCIONES RÁPIDAS ----- */
.quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.quick-options .option-btn {
    padding: 6px 14px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    background: white;
    color: #1a3a2f;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-options .option-btn:hover {
    border-color: #2d5a4a;
    background: #f0f5f2;
    transform: translateY(-1px);
}

/* ----- RESPONSIVE ----- */
@media (max-width: 576px) {
    .chatbot-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    
    .chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 24px;
    }
    
    .chat-body {
        padding: 15px;
    }
    
    .message {
        max-width: 92%;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .chat-footer {
        padding: 10px 15px;
    }
    
    .quick-options {
        padding: 8px 15px;
        gap: 6px;
    }
    
    .quick-options .option-btn {
        font-size: 11px;
        padding: 4px 12px;
    }
}

@media (max-width: 400px) {
    .chatbot-button {
        bottom: 15px;
        right: 15px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .chat-header .title {
        font-size: 14px;
    }
    
    .chat-footer input {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* ----- SCROLL PERSONALIZADO ----- */
.chat-body::-webkit-scrollbar {
    width: 4px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #2d5a4a;
    border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #1a3a2f;
}
/* Efecto de cursor parpadeante */
.message .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #2d5a4a;
    animation: blink 0.8s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 1px;
}

.message.user .cursor {
    background: white;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.message .pre {
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
    line-height: 1.5;
}

.message .pre strong {
    color: #1a3a2f;
}
/* Estilos para botones dentro de mensajes */
.message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.msg-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 20px;
    background: #2d5a4a;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.msg-btn:hover {
    transform: scale(1.05);
    background: #1a3a2f;
}

.msg-btn:active {
    transform: scale(0.95);
}

/* Efecto de cursor para escritura */
.message .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #2d5a4a;
    animation: blink 0.8s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 1px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
/* Estilos para botones dentro de mensajes */
.message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.msg-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    flex: 0 1 auto;
    color: white;
}

.msg-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

.msg-btn:active {
    transform: scale(0.95);
}

/* Colores de botones */
.btn-deuda { background: #0d6efd; }
.btn-extracto { background: #198754; }
.btn-promos { background: #ffc107; color: #212529; }
.btn-soporte { background: #dc3545; }
.btn-menu { background: #6c757d; }

/* Opciones rápidas con colores */
.option-btn {
    padding: 6px 14px;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    background: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Estilos para el indicador de escritura */
.typing-dots {
    display: inline-block;
    font-size: 18px;
    letter-spacing: 2px;
    animation: dots 1.4s infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}