/* ====================================
   PCEFACT PERU - Chatbot POTENTE v4.0
   Asistente Virtual Premium + Soporte en Vivo
   MAS GRANDE, MAS VISIBLE, MAS POTENTE
   ==================================== */

/* ====================================
   BOTÓN FLOTANTE - SUPER GRANDE Y VISIBLE
   ==================================== */
.chatbot-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 1050;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    animation: chatbot-float 3s ease-in-out infinite;
}

.chatbot-trigger-btn {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0056b3 0%, #003d82 30%, #00b894 70%, #00d4ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 35px rgba(0, 86, 179, 0.5), 0 0 0 5px rgba(0, 86, 179, 0.2), 0 0 60px rgba(0, 184, 148, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: none;
    outline: none;
}

.chatbot-trigger-btn::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 2.5px solid rgba(0, 86, 179, 0.35);
    animation: chatbot-pulse-ring 2s ease-out infinite;
}

.chatbot-trigger-btn::after {
    content: '';
    position: absolute;
    top: -12px;
    left: -12px;
    right: -12px;
    bottom: -12px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 184, 148, 0.2);
    animation: chatbot-pulse-ring 2s ease-out 0.5s infinite;
}

.chatbot-trigger-btn:hover {
    transform: scale(1.12) rotate(5deg);
    box-shadow: 0 14px 40px rgba(0, 86, 179, 0.55), 0 0 0 6px rgba(0, 86, 179, 0.2);
}

.chatbot-trigger-btn .robot-icon {
    font-size: 34px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    animation: robot-bounce 2s ease-in-out infinite;
}

@keyframes robot-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.chatbot-trigger-label {
    background: linear-gradient(135deg, #0056b3 0%, #00b894 100%);
    color: #fff;
    padding: 12px 22px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 6px 25px rgba(0, 86, 179, 0.4);
    animation: chatbot-label-glow 3s ease-in-out infinite;
    order: -1;
    letter-spacing: 0.3px;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255,255,255,0.15);
}

.chatbot-notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    border: 3px solid #fff;
    animation: chatbot-badge-pulse 1.2s ease infinite;
    box-shadow: 0 2px 10px rgba(255, 71, 87, 0.5);
}

/* ====================================
   VENTANA DEL CHAT - MÁS GRANDE
   ==================================== */
.chatbot-window {
    position: fixed;
    bottom: 120px;
    right: 28px;
    width: 440px;
    max-height: 680px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 1051;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-window.active {
    display: flex;
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ====================================
   HEADER PREMIUM
   ==================================== */
.chatbot-header {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 50%, #001f54 100%);
    padding: 22px 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: background 0.5s ease;
}

.chatbot-header.live-mode {
    background: linear-gradient(135deg, #00b894 0%, #00a381 50%, #00856a 100%);
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: shimmer 4s infinite;
}

.chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chatbot-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    position: relative;
    border: 2px solid rgba(255,255,255,0.15);
    transition: all 0.3s ease;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #2ecc71;
    border-radius: 50%;
    border: 2.5px solid rgba(0, 86, 179, 0.8);
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
}

.chatbot-header-text h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.3px;
}

.chatbot-header-text span {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 500;
}

.live-status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 6px;
    animation: live-pulse 1.5s ease infinite;
    vertical-align: middle;
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.6);
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg) scale(1.1);
}

/* ====================================
   FORMULARIO CHAT EN VIVO
   ==================================== */
.chatbot-live-form {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 25px;
    background: linear-gradient(180deg, #f0f7ff 0%, #fff 100%);
    flex: 1;
    min-height: 350px;
    animation: chatbot-msg-in 0.3s ease;
}

.chatbot-live-form-content {
    width: 100%;
    text-align: center;
}

.chatbot-live-form-icon {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b894, #00cec9);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 22px;
    font-size: 34px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 184, 148, 0.35);
    animation: chatbot-float 3s ease-in-out infinite;
}

.chatbot-live-form-content h5 {
    font-size: 19px;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.chatbot-live-form-content p {
    font-size: 13px;
    color: #888;
    margin: 0 0 22px;
}

.chatbot-live-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e8f0;
    border-radius: 14px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 12px;
    box-sizing: border-box;
    background: #fff;
}

.chatbot-live-input:focus {
    border-color: #00b894;
    box-shadow: 0 0 0 4px rgba(0, 184, 148, 0.1);
}

.chatbot-live-input.error {
    border-color: #ff4757;
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.1);
    animation: chatbot-shake 0.4s ease;
}

@keyframes chatbot-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.chatbot-live-connect-btn {
    width: 100%;
    padding: 14px 22px;
    background: linear-gradient(135deg, #00b894 0%, #00a381 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 0.3px;
}

.chatbot-live-connect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.45);
}

.chatbot-live-cancel-btn {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    color: #888;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.chatbot-live-cancel-btn:hover {
    border-color: #0056b3;
    color: #0056b3;
}

/* ====================================
   MENSAJES ADMIN (LIVE CHAT)
   ==================================== */
.chatbot-msg.admin-msg .chatbot-msg-avatar.admin-avatar {
    background: linear-gradient(135deg, #00b894, #00cec9);
}

.chatbot-msg-name {
    font-size: 11px;
    font-weight: 700;
    color: #00b894;
    margin-bottom: 4px;
    padding-left: 2px;
}

.chatbot-msg-bubble.admin-bubble {
    background: #e6fff9;
    border: 1px solid rgba(0, 184, 148, 0.2);
}

.chatbot-msg.system {
    justify-content: center;
    margin-bottom: 12px;
}

.chatbot-system-bubble {
    background: rgba(0, 86, 179, 0.06);
    color: #666;
    font-size: 12px;
    padding: 8px 16px;
    border-radius: 14px;
    text-align: center;
    max-width: 90%;
    font-weight: 500;
}

/* ====================================
   ÁREA DE MENSAJES
   ==================================== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    background: linear-gradient(180deg, #f5f8fc 0%, #f8fafd 100%);
    max-height: 380px;
    min-height: 260px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 86, 179, 0.2);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 86, 179, 0.35);
}

/* Mensajes */
.chatbot-msg {
    display: flex;
    margin-bottom: 18px;
    animation: chatbot-msg-in 0.35s ease;
}

.chatbot-msg.bot {
    justify-content: flex-start;
}

.chatbot-msg.user {
    justify-content: flex-end;
}

.chatbot-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    margin-top: 4px;
}

.chatbot-msg.bot .chatbot-msg-avatar {
    background: linear-gradient(135deg, #0056b3, #003d82);
    color: #fff;
    margin-right: 12px;
    box-shadow: 0 3px 10px rgba(0, 86, 179, 0.25);
}

.chatbot-msg-bubble {
    max-width: 82%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
}

.chatbot-msg.bot .chatbot-msg-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0,0,0,0.04);
}

.chatbot-msg.user .chatbot-msg-bubble {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 3px 12px rgba(0, 86, 179, 0.25);
}

.chatbot-msg-time {
    font-size: 10px;
    color: #aaa;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.chatbot-msg.user .chatbot-msg-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.65);
}

/* Indicador de escritura */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px 12px;
}

.chatbot-typing-dots {
    display: flex;
    gap: 5px;
    background: #fff;
    padding: 12px 18px;
    border-radius: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}

.chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    background: #0056b3;
    border-radius: 50%;
    animation: chatbot-typing-anim 1.4s infinite;
}

.chatbot-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ====================================
   RESPUESTAS RÁPIDAS - MÁS VISIBLES
   ==================================== */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px 8px;
    background: linear-gradient(180deg, #f5f8fc 0%, #fff 100%);
}

.chatbot-quick-btn {
    padding: 9px 18px;
    border: 2px solid #0056b3;
    border-radius: 22px;
    background: #fff;
    color: #0056b3;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.chatbot-quick-btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 86, 179, 0.3);
}

.chatbot-quick-btn.live-chat-btn {
    border-color: #00b894;
    color: #00b894;
    background: rgba(0, 184, 148, 0.04);
}

.chatbot-quick-btn.live-chat-btn:hover {
    background: linear-gradient(135deg, #00b894, #00a381);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 5px 15px rgba(0, 184, 148, 0.35);
}

.chatbot-quick-btn.switch-bot-btn {
    border-color: #0056b3;
    color: #0056b3;
    background: rgba(0, 86, 179, 0.04);
}

.chatbot-quick-btn.switch-bot-btn:hover {
    background: linear-gradient(135deg, #0056b3, #003d82);
    color: #fff;
    border-color: transparent;
}

/* ====================================
   INPUT AREA - MÁS MODERNO
   ==================================== */
.chatbot-input-area {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-input {
    flex: 1;
    padding: 13px 20px;
    border: 2px solid #e0e8f0;
    border-radius: 28px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    background: #f8fafd;
}

.chatbot-input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.08);
    background: #fff;
}

.chatbot-input::placeholder {
    color: #aab;
    font-weight: 500;
}

.chatbot-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(0, 86, 179, 0.3);
}

.chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 18px rgba(0, 86, 179, 0.4);
}

.chatbot-send:active {
    transform: scale(0.95);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Footer del chat */
.chatbot-powered {
    text-align: center;
    padding: 10px;
    font-size: 11px;
    color: #bbb;
    background: #f8fafd;
    font-weight: 500;
}

.chatbot-powered a {
    color: #0056b3;
    text-decoration: none;
    font-weight: 700;
}

.chatbot-powered a:hover {
    text-decoration: underline;
}

.live-indicator {
    color: #00b894;
    font-weight: 700;
}

.live-indicator i {
    font-size: 7px;
    vertical-align: middle;
    margin-right: 3px;
    animation: live-pulse 1.5s ease infinite;
}

/* Links en mensajes */
.chatbot-msg-bubble a {
    color: #0056b3;
    text-decoration: underline;
    font-weight: 600;
}

.chatbot-msg.user .chatbot-msg-bubble a {
    color: #fff;
}

/* Categorías */
.chatbot-category-tag {
    display: inline-block;
    background: rgba(0, 86, 179, 0.08);
    color: #0056b3;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ====================================
   ANIMACIONES MEJORADAS
   ==================================== */
@keyframes chatbot-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes chatbot-pulse-ring {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes chatbot-label-glow {
    0%, 100% { opacity: 1; box-shadow: 0 6px 20px rgba(0, 86, 179, 0.35); }
    50% { opacity: 0.85; box-shadow: 0 6px 25px rgba(0, 86, 179, 0.5); }
}

@keyframes chatbot-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes chatbot-msg-in {
    0% { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes chatbot-typing-anim {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 767.98px) {
    .chatbot-trigger {
        right: 14px;
        bottom: 18px;
    }

    .chatbot-trigger-label {
        display: none;
    }

    .chatbot-trigger-btn {
        width: 58px;
        height: 58px;
    }

    .chatbot-trigger-btn .robot-icon {
        font-size: 26px;
    }

    .chatbot-window {
        right: 8px;
        left: 8px;
        bottom: 95px;
        width: auto;
        max-height: 78vh;
        border-radius: 20px;
    }

    .chatbot-header {
        padding: 16px;
    }

    .chatbot-avatar {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .chatbot-messages {
        max-height: 320px;
        min-height: 200px;
        padding: 16px;
    }

    .chatbot-quick-replies {
        padding: 10px 16px;
    }

    .chatbot-quick-btn {
        font-size: 11px;
        padding: 7px 14px;
    }

    .chatbot-input-area {
        padding: 12px 16px;
    }

    .chatbot-live-form {
        padding: 24px 18px;
        min-height: 300px;
    }

    .chatbot-live-form-icon {
        width: 65px;
        height: 65px;
        font-size: 30px;
    }

    .chatbot-live-form-content h5 {
        font-size: 17px;
    }
}

@media (max-width: 575.98px) {
    .chatbot-window {
        bottom: 85px;
        max-height: 72vh;
    }

    .chatbot-messages {
        max-height: 260px;
    }

    .chatbot-trigger-btn {
        width: 56px;
        height: 56px;
    }

    .chatbot-trigger-btn .robot-icon {
        font-size: 24px;
    }
}

/* ====================================
   SCROLL TO TOP
   ==================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0056b3, #003d82);
    color: #fff;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    font-size: 18px;
    box-shadow: 0 5px 18px rgba(0, 86, 179, 0.35);
    transition: all 0.3s ease;
}

.scroll-top-btn.visible {
    display: flex;
    animation: chatbot-msg-in 0.3s ease;
}

.scroll-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 86, 179, 0.45);
}
