/* Chatbot Widget Styles */
:root {
    --chatbot-primary: #003366;
    --chatbot-primary-light: #004488;
    --chatbot-secondary: #f8f9fa;
    --chatbot-success: #28a745;
    --chatbot-text: #333;
    --chatbot-text-light: #666;
    --chatbot-border: #e0e0e0;
    --chatbot-shadow: 0 5px 40px rgba(0,0,0,0.16);
}

/* Botón flotante */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    background: var(--chatbot-primary-light);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.chatbot-toggle .close-icon {
    display: none;
}

.chatbot-toggle.active .chat-icon {
    display: none;
}

.chatbot-toggle.active .close-icon {
    display: block;
}

/* Badge de notificación */
.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* Contenedor del chat */
.chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: var(--chatbot-shadow);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-container.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del chat */
.chatbot-header {
    background: var(--chatbot-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
    color: #ffffff;
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--chatbot-secondary);
}

/* Mensajes */
.chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-message.bot {
    background: white;
    color: var(--chatbot-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chatbot-message.user {
    background: var(--chatbot-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-message.bot a {
    color: var(--chatbot-primary);
    text-decoration: underline;
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: var(--chatbot-text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Opciones rápidas */
.chatbot-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chatbot-option {
    background: var(--chatbot-secondary);
    border: 1px solid var(--chatbot-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--chatbot-text);
}

.chatbot-option:hover {
    background: var(--chatbot-primary);
    color: white;
    border-color: var(--chatbot-primary);
}

/* Input área */
.chatbot-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid var(--chatbot-border);
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--chatbot-border);
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input:focus {
    border-color: var(--chatbot-primary);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chatbot-send:hover {
    background: var(--chatbot-primary-light);
}

.chatbot-send:disabled {
    background: var(--chatbot-border);
    cursor: not-allowed;
}

.chatbot-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Estado de documentos */
.doc-status-list {
    margin: 8px 0;
    padding: 0;
    list-style: none;
}

.doc-status-item {
    padding: 6px 0;
    border-bottom: 1px solid var(--chatbot-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.doc-status-item:last-child {
    border-bottom: none;
}

.doc-status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.doc-status-icon.aprobado {
    background: #d4edda;
    color: #155724;
}

.doc-status-icon.pendiente {
    background: #fff3cd;
    color: #856404;
}

.doc-status-icon.rechazado {
    background: #f8d7da;
    color: #721c24;
}

.doc-status-icon.faltante {
    background: #e2e3e5;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }
}
