/* BudsiDesk Chatbot Widget Styles - Elegante y Compacto */

#budsi-chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    z-index: 9999;
}

/* ═══════════════════════════════════════════════════════════
   FLOATING TOGGLE BUTTON - Elegante
   ═══════════════════════════════════════════════════════════ */
.chatbot-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4B49AC 0%, #7978E9 100%);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(75, 73, 172, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    backdrop-filter: blur(10px);
}

.chatbot-toggle:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 24px rgba(75, 73, 172, 0.4);
}

.chatbot-toggle:active {
    transform: scale(0.92);
}

/* Unread Badge - Elegante */
.unread-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ═══════════════════════════════════════════════════════════
   CHATBOT CONTAINER - Compacto y Elegante
   ═══════════════════════════════════════════════════════════ */
.chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    height: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(75, 73, 172, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(75, 73, 172, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.chatbot-container.open {
    height: 480px;
    opacity: 1;
    visibility: visible;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ═══════════════════════════════════════════════════════════
   HEADER - Minimalista
   ═══════════════════════════════════════════════════════════ */
.chatbot-header {
    background: linear-gradient(135deg, #4B49AC 0%, #7978E9 100%);
    color: white;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.chatbot-title i {
    font-size: 15px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 15px;
    padding: 2px 2px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.chatbot-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════
   MESSAGES AREA - Limpio y Moderno
   ═══════════════════════════════════════════════════════════ */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, #fafbff 0%, #f5f7ff 100%);
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(75, 73, 172, 0.2);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(75, 73, 172, 0.4);
}

/* Messages Individuales */
.chatbot-message {
    display: flex;
    margin-bottom: 4px;
    animation: messageSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 85%;
    padding: 7px 10px;
    border-radius: 10px;
    word-wrap: break-word;
    line-height: 1.3;
    font-size: 0.8rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, #4B49AC 0%, #7978E9 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(75, 73, 172, 0.2);
}

.chatbot-message.bot .message-content {
    background: white;
    color: #4B49AC;
    border: 1px solid rgba(75, 73, 172, 0.1);
    border-bottom-left-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   INPUT AREA - Moderno y Limpio
   ═══════════════════════════════════════════════════════════ */
.chatbot-input-area {
    display: flex;
    gap: 6px;
    padding: 10px;
    background: white;
    border-top: 1px solid rgba(75, 73, 172, 0.08);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid #e0e0ff;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.8rem;
    color: #000000 !important;
    background: #f8f9ff;
    outline: none;
    transition: all 0.2s ease;
    caret-color: #4B49AC;
}

.chatbot-input:focus {
    border-color: #4B49AC;
    background: white;
    color: #000000 !important;
    box-shadow: 0 0 0 2px rgba(75, 73, 172, 0.06);
}

.chatbot-input::placeholder {
    color: #98BDFF;
    font-size: 0.75rem;
}

.chatbot-send {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #4B49AC 0%, #7978E9 100%);
    border: none;
    border-radius: 7px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 12px;
}

.chatbot-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(75, 73, 172, 0.3);
}

.chatbot-send:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE DESIGN - Mobile First
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        max-width: 380px;
        height: 0;
        bottom: 70px;
    }

    .chatbot-container.open {
        height: 480px;
    }

    .chatbot-toggle {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }

    .message-content {
        max-width: 90%;
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .chatbot-header {
        padding: 12px 14px;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .chatbot-input-area {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    #budsi-chatbot-widget {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-container {
        width: calc(100vw - 20px);
        bottom: 60px;
    }

    .chatbot-container.open {
        height: 400px;
    }

    .chatbot-toggle {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .chatbot-title {
        font-size: 0.85rem;
    }

    .message-content {
        font-size: 0.75rem;
        padding: 7px 9px;
    }

    .chatbot-input {
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .chatbot-send {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .unread-badge {
        width: 20px;
        height: 20px;
        font-size: 9px;
    }
}

/* ═══════════════════════════════════════════════════════════
   EFECTOS ESPECIALES
   ═══════════════════════════════════════════════════════════ */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(75, 73, 172, 0.3);
    }
    50% {
        box-shadow: 0 4px 24px rgba(75, 73, 172, 0.5);
    }
}

.chatbot-toggle:hover {
    animation: none;
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
    .chatbot-container {
        background: #1a1a2e;
    }

    .chatbot-messages {
        background: linear-gradient(180deg, #16213e 0%, #0f3460 100%);
    }

    .message-content {
        color: #e0e0e0;
    }

    .chatbot-message.bot .message-content {
        background: #16213e;
        color: #7978E9;
        border-color: rgba(121, 120, 233, 0.2);
    }

    .chatbot-input {
        background: #16213e;
        color: #000000 !important;
        border-color: rgba(121, 120, 233, 0.3);
    }

    .chatbot-input:focus {
        background: white;
        color: #000000 !important;
        border-color: #7978E9;
    }

    .chatbot-input::placeholder {
        color: #7978E9;
    }
}

