/* ─── Legasis Chatbot Widget ─── */

.dikera-chatbot {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ─── Toggle Button ─── */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #08102c 0%, #1a2744 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(8, 16, 44, 0.35);
    transition: all 0.3s ease;
    animation: chatbotPulse 3s infinite;
    position: relative;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(8, 16, 44, 0.45);
}

.chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chatbot-toggle .chat-icon { display: block; }
.chatbot-toggle .close-icon { display: none; }

.chatbot-toggle.active .chat-icon { display: none; }
.chatbot-toggle.active .close-icon { display: block; }

@keyframes chatbotPulse {
    0%   { box-shadow: 0 4px 20px rgba(8, 16, 44, 0.35); }
    50%  { box-shadow: 0 4px 28px rgba(8, 16, 44, 0.55); }
    100% { box-shadow: 0 4px 20px rgba(8, 16, 44, 0.35); }
}

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

/* ─── Chat Window ─── */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 520px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(8, 16, 44, 0.18);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

/* ─── Header ─── */
.chatbot-header {
    background: linear-gradient(135deg, #08102c 0%, #1a2744 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-header-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.chatbot-header-text .chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.chatbot-header-text .chatbot-status span {
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─── Messages Area ─── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fb;
    min-height: 0;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c5cc;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a0a4ac;
}

/* ─── Messages ─── */
.message {
    margin-bottom: 14px;
    animation: messageSlide 0.3s ease;
}

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

.message.bot { text-align: left; }
.message.user { text-align: right; }

.message-bubble {
    display: inline-block;
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot .message-bubble {
    background: white;
    color: #313a40;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 4px rgba(8, 16, 44, 0.08);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #08102c 0%, #1a2744 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

/* ─── Quick Replies ─── */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.quick-reply {
    background: #eef1f6;
    color: #08102c;
    padding: 7px 12px;
    border: 1px solid #dde1e8;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.3;
}

.quick-reply:hover {
    background: #08102c;
    color: white;
    border-color: #08102c;
}

/* ─── Input Area ─── */
.chatbot-input {
    padding: 12px;
    background: white;
    border-top: 1px solid #eef1f4;
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #dde1e8;
    border-radius: 14px;
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fb;
    color: #313a40;
    min-height: 20px;
    box-sizing: border-box;
}

.message-input:focus {
    border-color: #08102c;
    box-shadow: 0 0 0 3px rgba(8, 16, 44, 0.08);
    background: white;
}

.message-input::placeholder {
    color: #9ca3af;
}

.send-button {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #08102c 0%, #1a2744 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(8, 16, 44, 0.25);
}

.send-button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

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

.typing-dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0; }

@keyframes typingPulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1); opacity: 1; }
}

/* ─── Mobile Responsive ─── */
@media (max-width: 480px) {
    .dikera-chatbot {
        bottom: 20px;
        right: 20px;
    }

    .chatbot-toggle {
        width: 54px;
        height: 54px;
    }

    .chatbot-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 84px;
        right: 20px;
        left: 20px;
    }

    .chatbot-messages {
        padding: 12px;
    }

    .message-input {
        font-size: 16px;
    }
}
