/* --------------------------------------------------------------------------
   TeknoBot Chatbot Widget
   -------------------------------------------------------------------------- */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* ── Toggle Button ────────────────────────────────────────── */
.chatbot-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    position: relative;
    color: #fff;
    font-size: 28px;
    animation: chatbot-pulse 2s infinite;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.6);
}

@keyframes chatbot-pulse {
    0%   { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
    50%  { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.8); }
    100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    animation: chatbot-bounce 1s infinite;
}

@keyframes chatbot-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* ── Panel ────────────────────────────────────────────────── */
.chatbot-panel {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 370px;
    max-height: 540px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: bottom right;
}

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

/* ── Header ───────────────────────────────────────────────── */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-avatar {
    position: relative;
    flex-shrink: 0;
}

.chatbot-avatar img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.chatbot-online {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    background: #25d366;
    border: 2px solid #fff;
    border-radius: 50%;
}

.chatbot-header-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
}

.chatbot-header-status {
    font-size: 11px;
    opacity: 0.85;
}

.chatbot-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* ── Messages ─────────────────────────────────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 220px;
    max-height: 320px;
}

.chat-msg {
    display: flex;
    animation: chatbot-fadeIn 0.35s ease;
}

.chat-msg.bot {
    justify-content: flex-start;
}

.chat-msg.user {
    justify-content: flex-end;
}

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

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

.chat-msg.bot .chat-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Quick option buttons */
.chat-quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.chat-quick-btn {
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.25);
    color: #047857;
    padding: 6px 12px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-quick-btn:hover {
    background: rgba(5, 150, 105, 0.18);
    border-color: #059669;
    transform: translateY(-1px);
}

/* ── Typing indicator ─────────────────────────────────────── */
.chatbot-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 10px;
    background: #f0f2f5;
    font-size: 12px;
    color: #888;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #aaa;
    animation: typingDot 1.4s infinite;
}

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

@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1; transform: translateY(-3px); }
}

/* ── Input area ───────────────────────────────────────────── */
.chatbot-input-area {
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.chatbot-input-area form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12);
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(5, 150, 105, 0.35);
}

/* ── WhatsApp fallback footer ─────────────────────────────── */
.chatbot-wsp-footer {
    display: flex;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    animation: chatbot-fadeIn 0.3s ease;
}

.chatbot-wsp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: #fff;
    text-decoration: none;
    border-radius: 24px;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.2s;
}

.chatbot-wsp-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
    color: #fff;
}

.chatbot-wsp-btn i {
    font-size: 18px;
}

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

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

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

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

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 14px;
        right: 14px;
    }

    .chatbot-panel {
        width: 320px;
        max-height: 480px;
    }

    .chatbot-toggle-btn {
        width: 54px;
        height: 54px;
        font-size: 24px;
    }
}

@media (max-width: 400px) {
    .chatbot-panel {
        width: calc(100vw - 28px);
        right: 0;
        max-height: 70vh;
    }
}
