/* ===== CHATBOT STYLES — Premium Edition ===== */

/* ── Toggle Button ── */
#chatbot-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 6px 24px rgba(124, 58, 237, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbot-entry 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both;
}


#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow:
        0 10px 36px rgba(124, 58, 237, 0.55),
        0 4px 12px rgba(0, 0, 0, 0.12);
}

#chatbot-toggle.active {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
    transform: scale(1);
}

.chatbot-toggle-icon {
    color: #fff;
    font-size: 1.35rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s ease;
}

#chatbot-toggle.active .chatbot-toggle-icon {
    transform: rotate(90deg);
}

/* Pulsing ring */
.chatbot-toggle-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.25);
    animation: chatbot-pulse 2.5s ease-out infinite;
    pointer-events: none;
}

#chatbot-toggle.active .chatbot-toggle-pulse {
    animation: none;
    opacity: 0;
}

@keyframes chatbot-pulse {
    0% {
        transform: scale(1);
        opacity: 0.55;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes chatbot-entry {
    from {
        opacity: 0;
        transform: scale(0) translateY(30px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Chat Window ── */
#chatbot-window {
    position: fixed;
    bottom: 104px;
    right: 28px;
    width: 410px;
    height: 560px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(24px) scale(0.92);
    transform-origin: bottom right;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease,
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

#chatbot-window.chatbot-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Header ── */
.chatbot-header {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* Decorative shimmer */
.chatbot-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.25);
    color: #fff;
}

.chatbot-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background: #22c55e;
    border-radius: 50%;
    border: 2.5px solid #7c3aed;
}

.chatbot-header-name {
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.15px;
}

.chatbot-header-status {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-top: 1px;
    font-weight: 400;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ── Messages Container ── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(180deg, #faf9ff 0%, #f5f3ff 50%, #f9fafb 100%);
    scroll-behavior: smooth;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.2);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(124, 58, 237, 0.35);
}

/* ── Message Row ── */
.chatbot-message {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    width: 100%;

    /* Entry animation */
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.chatbot-message.chatbot-msg-show {
    opacity: 1;
    transform: translateY(0);
}

/* Bot messages — left aligned */
.chatbot-bot {
    justify-content: flex-start;
}

/* User messages — right aligned */
.chatbot-user {
    justify-content: flex-end;
}

/* ── Avatar ── */
.chatbot-msg-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    flex-shrink: 0;
}

/* ── Message Bubble ── */
.chatbot-msg-bubble {
    padding: 11px 15px;
    font-size: 0.86rem;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Bot bubble */
.chatbot-bot .chatbot-msg-bubble {
    background: #ffffff;
    color: #1e293b;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid #ede9fe;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    max-width: min(82%, 300px);
}

/* User bubble */
.chatbot-user .chatbot-msg-bubble {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 3px 12px rgba(124, 58, 237, 0.25);
    max-width: min(78%, 280px);
    min-width: 40px;
}

/* Links inside bubbles */
.chatbot-bot .chatbot-msg-bubble a {
    color: #7c3aed;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.chatbot-user .chatbot-msg-bubble a {
    color: #e0d4ff;
    text-decoration: underline;
}

.chatbot-msg-bubble strong {
    font-weight: 600;
}

.chatbot-msg-bubble em {
    font-style: italic;
    opacity: 0.85;
}

/* ── Typing Indicator ── */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 4px 2px;
    align-items: center;
}

.chatbot-typing span {
    width: 7px;
    height: 7px;
    background: #a78bfa;
    border-radius: 50%;
    display: inline-block;
    animation: chatbot-bounce 1.3s ease-in-out infinite;
}

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

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

@keyframes chatbot-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ── Input Area ── */
.chatbot-input-area {
    border-top: 1px solid #f0ecff;
    background: #ffffff;
    flex-shrink: 0;
}

.chatbot-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
}

#chatbot-input {
    flex: 1;
    min-width: 0;
    /* Prevent flex overflow */
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 0.86rem;
    font-family: 'Outfit', sans-serif;
    color: #1e293b;
    background: #faf9ff;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

#chatbot-input:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
    background: #ffffff;
}

#chatbot-input::placeholder {
    color: #a0aec0;
    font-size: 0.84rem;
}

#chatbot-input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    transition: all 0.25s ease;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 5px 16px rgba(124, 58, 237, 0.45);
}

.chatbot-send-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.chatbot-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Quick Reply Buttons ── */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 14px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.chatbot-quick-replies.chatbot-qr-show {
    padding: 10px 14px 4px;
    max-height: 100px;
}

.chatbot-qr-btn {
    background: #f5f3ff;
    border: 1.5px solid #e9e5f5;
    color: #7c3aed;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.3;
}

.chatbot-qr-btn:hover {
    background: #7c3aed;
    color: #ffffff;
    border-color: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
}

.chatbot-qr-btn:active {
    transform: translateY(0) scale(0.97);
}

/* ── Responsive ── */

/* Full-screen on small phones */
@media (max-width: 480px) {
    #chatbot-window {
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        bottom: 0;
        right: 0;
    }

    #chatbot-toggle {
        bottom: 18px;
        right: 18px;
        width: 56px;
        height: 56px;
    }

    .chatbot-toggle-icon {
        font-size: 1.2rem;
    }

    .chatbot-msg-bubble {
        font-size: 0.88rem;
    }
}

/* Medium tablets */
@media (min-width: 481px) and (max-width: 768px) {
    #chatbot-window {
        right: 14px;
        bottom: 96px;
        width: 370px;
        height: 500px;
    }
}