/* ================================
   Chatbot H.A.R.T.P - Estilos
   ================================ */

/* Widget principal */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Botón flotante */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.6);
}

.chatbot-toggle.active {
    background: #6B7280;
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Ventana del chat */
.chatbot-window {
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 10px;
    transition: opacity 0.3s, transform 0.3s;
}

.chatbot-window.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

/* Header del chat */
.chatbot-header {
    background: linear-gradient(135deg, #1E3A8A, #10B981);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.chatbot-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 280px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message.bot {
    background: white;
    border: 1px solid #E2E8F0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.user {
    background: #10B981;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-actions {
    margin-top: 6px;
    display: flex;
    gap: 8px;
}

.speak-btn {
    background: none;
    border: 1px solid #CBD5E1;
    color: #64748B;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.speak-btn:hover {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

/* Respuestas rápidas */
.quick-replies {
    padding: 8px 16px;
    background: white;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.quick-replies::-webkit-scrollbar {
    display: none;
}

.quick-reply {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.quick-reply:hover {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

/* Formulario de input */
.chatbot-form {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 8px;
}

.chatbot-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #E2E8F0;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-form input:focus {
    border-color: #10B981;
}

.chatbot-form button {
    background: #10B981;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.chatbot-form button:hover {
    background: #059669;
}

/* ================================
   MODO OSCURO
   ================================ */
.chatbot-widget.dark .chatbot-window {
    background: #1E293B;
    color: #E2E8F0;
}

.chatbot-widget.dark .chatbot-messages {
    background: #0F172A;
}

.chatbot-widget.dark .message.bot {
    background: #334155;
    border-color: #475569;
    color: #E2E8F0;
}

.chatbot-widget.dark .quick-replies {
    background: #1E293B;
    border-color: #334155;
}

.chatbot-widget.dark .quick-reply {
    background: #334155;
    border-color: #475569;
    color: #E2E8F0;
}

.chatbot-widget.dark .quick-reply:hover {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

.chatbot-widget.dark .chatbot-form {
    background: #1E293B;
    border-color: #334155;
}

.chatbot-widget.dark .chatbot-form input {
    background: #334155;
    border-color: #475569;
    color: #E2E8F0;
}

.chatbot-widget.dark .chatbot-form input::placeholder {
    color: #94A3B8;
}

.chatbot-widget.dark .speak-btn {
    border-color: #475569;
    color: #94A3B8;
}

.chatbot-widget.dark .speak-btn:hover {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        max-height: 70vh;
    }
    
    .chatbot-toggle {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
}

/* ================================
   ACCESIBILIDAD
   ================================ */
@media (prefers-reduced-motion: reduce) {
    .chatbot-toggle,
    .control-btn,
    .quick-reply,
    .speak-btn {
        transition: none !important;
    }
    
    @keyframes pulse {
        animation: none;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .chatbot-toggle,
    .message.user,
    .chatbot-form button {
        border: 2px solid white;
    }
}