/* ============ CHATBOT WIDGET ============ */

/* Floating Button */
.chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatbot-pulse 3s ease-in-out infinite;
}

.chatbot-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.6);
}

.chatbot-btn svg {
    width: 26px;
    height: 26px;
    color: white;
    transition: transform 0.3s ease;
}

.chatbot-btn.open svg.icon-chat {
    display: none;
}

.chatbot-btn.open svg.icon-close {
    display: block;
}

.chatbot-btn:not(.open) svg.icon-chat {
    display: block;
}

.chatbot-btn:not(.open) svg.icon-close {
    display: none;
}

@keyframes chatbot-pulse {
    0%, 100% { box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4), 0 0 0 8px rgba(99, 102, 241, 0.1); }
}

/* Notification dot */
.chatbot-btn .notif-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
    animation: pulse-dot 2s ease-in-out infinite;
}

.chatbot-btn.open .notif-dot {
    display: none;
}

/* Chat Panel */
.chatbot-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    height: 580px;
    background: rgba(10, 10, 18, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    z-index: 9997;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(99, 102, 241, 0.08);
}

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

/* Panel Header */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chatbot-header-status {
    font-size: 0.7rem;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
}

.chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.chatbot-close svg {
    width: 16px;
    height: 16px;
}

/* Chat Body */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chatbot-body::-webkit-scrollbar {
    width: 4px;
}

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

.chatbot-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Messages */
.chatbot-msg {
    display: flex;
    gap: 0.5rem;
    max-width: 90%;
    animation: msgFadeIn 0.3s ease forwards;
}

.chatbot-msg.bot {
    align-self: flex-start;
}

.chatbot-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatbot-msg.user .chatbot-msg-avatar {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.chatbot-msg-bubble {
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.chatbot-msg.bot .chatbot-msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chatbot-msg.user .chatbot-msg-bubble {
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

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

/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 0.5rem;
    align-self: flex-start;
    max-width: 90%;
}

.chatbot-typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.7rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.chatbot-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Options Area */
.chatbot-options {
    padding: 0.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}

.chatbot-option-btn {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.chatbot-option-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.chatbot-option-btn:active {
    transform: translateX(2px) scale(0.99);
}

/* Multi-select */
.chatbot-multi-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.chatbot-multi-option:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

.chatbot-multi-option.selected {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.4);
}

.chatbot-multi-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chatbot-multi-option.selected .chatbot-multi-check {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.chatbot-multi-check svg {
    width: 12px;
    height: 12px;
    color: white;
    opacity: 0;
}

.chatbot-multi-option.selected .chatbot-multi-check svg {
    opacity: 1;
}

.chatbot-continue-btn {
    width: 100%;
    padding: 0.65rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-top: 0.25rem;
}

.chatbot-continue-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.chatbot-continue-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Text Input Area */
.chatbot-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input:focus {
    border-color: rgba(99, 102, 241, 0.4);
}

.chatbot-input::placeholder {
    color: var(--text-tertiary);
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    opacity: 0.9;
    transform: scale(1.04);
}

.chatbot-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.chatbot-send-btn svg {
    width: 16px;
    height: 16px;
    color: white;
}

.chatbot-skip-btn {
    padding: 0.4rem 0.75rem;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
    width: 100%;
    font-family: inherit;
    transition: color 0.2s ease;
}

.chatbot-skip-btn:hover {
    color: var(--text-secondary);
}

/* Summary */
.chatbot-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.chatbot-summary strong {
    color: var(--text-primary);
}

/* Tablet Responsive */
@media (max-width: 968px) and (min-width: 641px) {
    .chatbot-panel {
        width: 340px;
        height: 520px;
        bottom: 92px;
        right: 20px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-btn {
        bottom: 80px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 640px) {
    .chatbot-btn {
        bottom: 80px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .chatbot-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100dvh;
    }

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