.deepseek-chatbot {
    position: fixed;
    width: 380px;
    height: 550px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.deepseek-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.deepseek-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.deepseek-chatbot-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.deepseek-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.deepseek-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.2s;
}

.deepseek-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.deepseek-chatbot-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.deepseek-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8fafc;
}

.deepseek-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deepseek-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: messageAppear 0.3s ease-out;
}

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

.deepseek-user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border-bottom-right-radius: 5px;
}

.deepseek-bot-message {
    align-self: flex-start;
    background: white;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.deepseek-message-content {
    white-space: pre-wrap;
}

.deepseek-message-content a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.deepseek-message-content a:hover {
    color: #1d4ed8;
}

.deepseek-input-container {
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: white;
}

.deepseek-input-container textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 12px 16px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

.deepseek-input-container textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.deepseek-send {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 70px;
}

.deepseek-send:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
}

.deepseek-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.deepseek-chatbot-footer {
    padding: 12px 15px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    background: #f8fafc;
    border-radius: 0 0 15px 15px;
}

.deepseek-chatbot-footer small {
    color: #64748b;
    font-size: 11px;
}

.deepseek-typing {
    display: inline-block;
}

.deepseek-typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
    margin: 0 2px;
    animation: deepseek-typing 1.4s infinite ease-in-out;
}

.deepseek-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.deepseek-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Botón flotante para abrir chat */
.deepseek-chatbot-toggle {
    position: fixed;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    z-index: 9999;
    display: none;
    transition: all 0.3s ease;
}

.deepseek-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.deepseek-toggle-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

/* Fuentes de información */
.deepseek-sources {
    margin-top: 10px;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 10px;
    border-left: 3px solid #2563eb;
}

.deepseek-sources-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 5px;
}

.deepseek-source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
}

.deepseek-source-item:last-child {
    border-bottom: none;
}

.deepseek-source-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 12px;
    flex: 1;
}

.deepseek-source-link:hover {
    text-decoration: underline;
}

.deepseek-source-similarity {
    font-size: 10px;
    color: #94a3b8;
    margin-left: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .deepseek-chatbot {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
    }
    
    .deepseek-chatbot-toggle {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }
    
    .deepseek-toggle-icon {
        font-size: 20px;
    }
}

/* Scrollbar personalizado */
.deepseek-messages-container::-webkit-scrollbar {
    width: 6px;
}

.deepseek-messages-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.deepseek-messages-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.deepseek-messages-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================================================== */
/* PROTECCIÓN CONTRA CONFLICTOS DE TEMAS - ESTILOS FORZADOS */
/* ========================================================================== */

/* Reset y protección global para el chatbot */
#deepseek-chatbot * {
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

/* PROTECCIÓN ESPECÍFICA PARA MENSAJES DEL USUARIO */
.deepseek-user-message,
.deepseek-user-message *,
.deepseek-user-message .deepseek-message-content,
.deepseek-user-message .deepseek-message-content * {
    color: #ffffff !important;
    font-weight: 500 !important;
    text-shadow: none !important;
}

/* PROTECCIÓN ESPECÍFICA PARA MENSAJES DEL BOT */
.deepseek-bot-message,
.deepseek-bot-message *,
.deepseek-bot-message .deepseek-message-content,
.deepseek-bot-message .deepseek-message-content * {
    color: #334155 !important;
    font-weight: normal !important;
    text-shadow: none !important;
}

/* Reset específico para elementos que los temas suelen modificar */
#deepseek-chatbot a,
#deepseek-chatbot p,
#deepseek-chatbot span,
#deepseek-chatbot div,
#deepseek-chatbot li,
#deepseek-chatbot ul,
#deepseek-chatbot ol {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Protección para enlaces dentro del chatbot */
#deepseek-chatbot a,
.deepseek-message-content a,
.deepseek-source-link {
    color: #2563eb !important;
    text-decoration: underline !important;
    background: transparent !important;
    border: none !important;
}

#deepseek-chatbot a:hover,
.deepseek-message-content a:hover,
.deepseek-source-link:hover {
    color: #1d4ed8 !important;
    text-decoration: underline !important;
    background: transparent !important;
}

/* Protección contra estilos de temas para botones */
#deepseek-chatbot button,
.deepseek-send,
.deepseek-toggle {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 12px 20px !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

#deepseek-chatbot button:hover,
.deepseek-send:hover,
.deepseek-toggle:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
    transform: translateY(-1px) !important;
}

/* Protección para textarea */
#deepseek-chatbot textarea,
.deepseek-input-container textarea {
    border: 1px solid #d1d5db !important;
    border-radius: 20px !important;
    padding: 12px 16px !important;
    font-family: inherit !important;
    font-size: 14px !important;
    background: white !important;
    color: #334155 !important;
    box-shadow: none !important;
}

#deepseek-chatbot textarea:focus,
.deepseek-input-container textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
    outline: none !important;
}

/* Protección para headers */
#deepseek-chatbot h1,
#deepseek-chatbot h2,
#deepseek-chatbot h3,
#deepseek-chatbot h4,
#deepseek-chatbot h5,
#deepseek-chatbot h6,
.deepseek-chatbot-header h3 {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-weight: 600 !important;
    color: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
}

/* Protección específica para el header */
.deepseek-chatbot-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: white !important;
}

.deepseek-chatbot-header * {
    color: white !important;
}

/* Protección para fuentes pequeñas */
#deepseek-chatbot small,
.deepseek-chatbot-footer small {
    color: #64748b !important;
    font-size: 11px !important;
}

/* Reset de fondos para contenedores principales */
#deepseek-chatbot,
.deepseek-chatbot-body,
.deepseek-messages-container,
.deepseek-chatbot-footer {
    background: inherit !important;
}

.deepseek-messages-container {
    background: #f8fafc !important;
}

.deepseek-chatbot-footer {
    background: #f8fafc !important;
}

/* Protección final - reset nuclear para elementos dentro del chatbot */
#deepseek-chatbot {
    all: initial !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

#deepseek-chatbot * {
    all: unset !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
}
