/* public/css/chatbot.css */

:root {
    --chat-primary: #3b82f6;
    --chat-accent: #60a5fa;
    --chat-glass: rgba(15, 23, 42, 0.8);
    --chat-bg: #0f172a;
}

/* Floating Toggle Button */
.chat-toggle-btn {
    position: fixed;
    right: 30px;
    bottom: 30px;
    /* Aligned with back-to-top on some pages, we might need offset */
    width: 65px;
    height: 65px;
    background: var(--chat-primary);
    border: none;
    border-radius: 20px 20px 5px 20px;
    z-index: 1050;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* WhatsApp Floating Button */
.whatsapp-btn {
    position: fixed;
    right: 30px;
    bottom: 110px;
    /* Positioned above the chat button */
    width: 60px;
    height: 60px;
    background: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    text-decoration: none;
    z-index: 1050;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.3);
}

.whatsapp-btn:hover {
    transform: scale(1.15) rotate(15deg);
    color: white;
    box-shadow: 0 15px 35px rgba(37, 211, 102, 0.5);
}

.chat-toggle-btn:hover {
    transform: translateY(-8px) scale(1.1) rotate(-5deg);
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
}

.chat-btn-inner {
    position: relative;
    font-size: 1.8rem;
}

.chat-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #ef4444;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 800;
    border: 2px solid white;
}

/* Custom Modal Size & Glass */
.modal-chat-custom {
    max-width: 380px !important;
    margin-right: 25px !important;
    margin-bottom: 70px !important;
    /* Lowered from 90px */
    align-items: flex-end !important;
}

.glass-chat-content {
    background: var(--chat-glass) !important;
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 30px !important;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

.glass-chat-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.ia-avatar-wrapper {
    width: 50px;
    height: 50px;
    background: var(--chat-primary);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    position: relative;
}

.pulse-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid var(--chat-bg);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Messages Area (Messenger Style) */
.chat-messages-container {
    height: 370px !important;
    /* Reduced from 350px */
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(2, 6, 23, 0.7);
}

.message-group {
    max-width: 85%;
    display: flex;
    align-items: flex-end;
}

.message-group.agent {
    align-self: flex-start;
}

.message-group.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-text {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.85rem;
    /* Slightly smaller text */
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    max-width: 100%;
}

.agent .message-text {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user .message-text {
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

/* Links inside chat */
.message-text a {
    color: #93c5fd;
    text-decoration: underline;
    font-weight: 600;
}

.user .message-text a {
    color: white;
    text-decoration: underline;
}

/* Input Styles */
.glass-chat-footer {
    background: rgba(255, 255, 255, 0.03);
}

.chat-input-custom {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 15px !important;
    padding: 12px 20px !important;
    font-size: 0.9rem !important;
}

.chat-input-custom:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--chat-primary) !important;
    box-shadow: none !important;
}

.btn-chat-send {
    width: 48px;
    height: 48px;
    border-radius: 15px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-chat-clear {
    width: 48px;
    height: 48px;
    border-radius: 15px !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    color: rgba(239, 68, 68, 0.6) !important;
}

.btn-chat-clear:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    width: fit-content;
}

.typing span {
    width: 6px;
    height: 6px;
    background: var(--chat-accent);
    border-radius: 50%;
    animation: bounce-typing 1.4s infinite ease-in-out;
    opacity: 0.6;
}

.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce-typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Scroll Custom */
.scroll-custom::-webkit-scrollbar {
    width: 6px;
}

.scroll-custom::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-custom::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}