/**
 * Chatbot Profesional 24/7 - Codivis
 * Estilos responsive para Desktop y Mobile
 */

/* ===== BOTÓN FLOTANTE (solo mobile) ===== */
#chatbot-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #015fc9 0%, #0146a0 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(1, 95, 201, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: none; /* Oculto por defecto, visible solo en mobile */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

#chatbot-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(1, 95, 201, 0.6);
}

#chatbot-float-btn i {
    font-size: 28px;
    color: #fff;
}

#chatbot-float-btn .badge-online {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Animación de pulso */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Mostrar botón flotante solo en mobile */
@media (max-width: 991px) {
    #chatbot-float-btn {
        display: flex;
    }
}

/* ===== VENTANA DE CHAT ===== */
#chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

#chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive mobile */
@media (max-width: 991px) {
    #chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* ===== HEADER DEL CHAT ===== */
#chatbot-header {
    background: linear-gradient(135deg, #015fc9 0%, #0146a0 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#chatbot-header .status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

#chatbot-header .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== FORMULARIO INICIAL ===== */
#chatbot-form-container {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

#chatbot-form-container h4 {
    color: #015fc9;
    margin: 0 0 10px 0;
    font-size: 16px;
}

#chatbot-form-container p {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px 0;
}

#chatbot-form-container input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.3s;
}

#chatbot-form-container input:focus {
    outline: none;
    border-color: #015fc9;
}

#chatbot-start-btn {
    background: linear-gradient(135deg, #015fc9 0%, #0146a0 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#chatbot-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 95, 201, 0.4);
}

#chatbot-start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ===== ÁREA DE MENSAJES ===== */
#chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
    display: none; /* Oculto hasta que se complete el formulario */
}

#chatbot-messages.active {
    display: block;
}

/* Mensaje individual */
.chat-message {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
    justify-content: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #015fc9;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.user .chat-message-avatar {
    background: #6c757d;
    order: 2;
}

.chat-message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.bot .chat-message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-message.user .chat-message-content {
    background: #015fc9;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    text-align: right;
}

/* Indicador "escribiendo..." */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #015fc9;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* ===== ÁREA DE INPUT ===== */
#chatbot-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: none; /* Oculto hasta que se complete el formulario */
}

#chatbot-input-area.active {
    display: flex;
    gap: 10px;
}

#chatbot-message-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
}

#chatbot-message-input:focus {
    outline: none;
    border-color: #015fc9;
}

#chatbot-send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #015fc9 0%, #0146a0 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

#chatbot-send-btn:hover {
    transform: scale(1.1);
}

#chatbot-send-btn i {
    font-size: 18px;
}

/* ===== SCROLLBAR PERSONALIZADO ===== */
#chatbot-messages::-webkit-scrollbar,
#chatbot-form-container::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track,
#chatbot-form-container::-webkit-scrollbar-track {
    background: #f0f0f0;
}

#chatbot-messages::-webkit-scrollbar-thumb,
#chatbot-form-container::-webkit-scrollbar-thumb {
    background: #015fc9;
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover,
#chatbot-form-container::-webkit-scrollbar-thumb:hover {
    background: #0146a0;
}
