/* ========================================
   BIT Website - Chatbot Widget
   Premium 3D Animated Chat Assistant
   ======================================== */

/* ========== Chatbot Container ========== */
.chatbot-widget {
    position: fixed;
    left: 24px;
    bottom: 100px;
    z-index: 1000;
    font-family: var(--font-primary);
}

/* ========== Floating Button with 3D Effect ========== */
.chatbot-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 8px 32px rgba(0, 180, 216, 0.4),
        0 0 0 0 rgba(0, 180, 216, 0.4);
}

.chatbot-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--gradient-primary);
    opacity: 0.3;
    filter: blur(10px);
    z-index: -1;
    transition: all 0.3s ease;
}

.chatbot-button:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow:
        0 15px 40px rgba(0, 180, 216, 0.5),
        0 0 60px rgba(0, 180, 216, 0.3);
}

.chatbot-button:hover::before {
    opacity: 0.5;
    inset: -8px;
}

@keyframes chatbotPulse {

    0%,
    100% {
        box-shadow:
            0 8px 32px rgba(0, 180, 216, 0.4),
            0 0 0 0 rgba(0, 180, 216, 0.4);
    }

    50% {
        box-shadow:
            0 8px 32px rgba(0, 180, 216, 0.4),
            0 0 0 15px rgba(0, 180, 216, 0);
    }
}

/* 3D Canvas for Robot Icon */
.chatbot-3d-canvas {
    width: 40px;
    height: 40px;
    pointer-events: none;
}

/* Fallback Icon */
.chatbot-icon {
    width: 32px;
    height: 32px;
    stroke: white;
    fill: none;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.chatbot-button:hover .chatbot-icon {
    transform: rotate(15deg) scale(1.1);
}

/* Chatbot Image Icon */
.chatbot-icon-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.chatbot-button:hover .chatbot-icon-img {
    transform: scale(1.1);
}

.chatbot-widget.active .chatbot-icon-img {
    display: none;
}

/* Close Icon (when chat is open) */
.chatbot-close-icon {
    display: none;
    width: 28px;
    height: 28px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

.chatbot-widget.active .chatbot-icon {
    display: none;
}

.chatbot-widget.active .chatbot-close-icon {
    display: block;
}

.chatbot-widget.active .chatbot-button {
    animation: none;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* ========== Chat Window ========== */
.chatbot-window {
    position: absolute;
    left: 0;
    bottom: 80px;
    width: 380px;
    max-height: 600px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom left;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

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

/* Chat Header */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.95);
    z-index: 2;
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-avatar svg {
    width: 26px;
    height: 26px;
    stroke: white;
    fill: none;
}

.chatbot-header-info h4 {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.chatbot-header-info span {
    color: #22c55e;
    font-size: 0.8rem;
}

/* Chat Messages Area */
.chatbot-messages {
    height: 350px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.chat-message.bot {
    align-self: flex-start;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-avatar svg {
    width: 18px;
    height: 18px;
    stroke: white;
    fill: none;
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
}

.message-content {
    background: rgba(255, 255, 255, 0.08);
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.user .message-content {
    background: var(--gradient-primary);
    border-radius: 16px;
    border-top-right-radius: 4px;
    color: white;
}

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

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: typingDot 1.4s ease-in-out infinite;
}

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

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

@keyframes typingDot {

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

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

/* Chat Input Area */
.chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 28px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 20px 20px;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 180, 216, 0.4);
}

.chatbot-send-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-reply-btn {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-reply-btn:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
    .chatbot-widget {
        left: 20px;
        bottom: 24px;
        /* Ensure it's above other fixed elements */
        z-index: 1001;
    }

    .chatbot-button {
        width: 52px;
        height: 52px;
        /* Disable all animations on mobile for static clickability */
        animation: none !important;
        transform: none !important;
        transition: none !important;
    }

    .chatbot-button::before {
        animation: none !important;
        transition: none !important;
    }

    /* Prevent hover effects on touch devices */
    .chatbot-button:hover,
    .chatbot-button:focus,
    .chatbot-button:active {
        box-shadow: 0 8px 32px rgba(0, 180, 216, 0.4);
        transform: none !important;
    }

    /* Prevent hover effects on touch devices */
    .chatbot-button:hover {
        transform: none;
        box-shadow: 0 8px 32px rgba(0, 180, 216, 0.4);
    }

    .chatbot-button:hover .chatbot-icon,
    .chatbot-button:hover .chatbot-icon-img {
        transform: none !important;
    }

    .chatbot-button:active {
        transform: none !important;
    }

    .chatbot-icon {
        width: 26px;
        height: 26px;
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }

    .chatbot-icon-img {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }

    .chatbot-window {
        position: fixed;
        width: calc(100vw - 32px);
        max-width: 360px;
        max-height: 60vh;
        left: 16px;
        bottom: 80px;
        right: auto;
    }

    .chatbot-header {
        padding: 14px 16px;
    }

    .chatbot-avatar {
        width: 40px;
        height: 40px;
    }

    .chatbot-avatar svg {
        width: 22px;
        height: 22px;
    }

    .chatbot-header-info h4 {
        font-size: 0.95rem;
    }

    .chatbot-header-info span {
        font-size: 0.75rem;
    }

    .chatbot-messages {
        height: calc(60vh - 180px);
        min-height: 150px;
        max-height: 280px;
        padding: 14px;
        gap: 12px;
    }

    .message-content {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
    }

    .message-avatar svg {
        width: 16px;
        height: 16px;
    }

    .quick-replies {
        padding: 10px 14px;
        gap: 6px;
    }

    .quick-reply-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .chatbot-input-area {
        padding: 12px 14px;
        gap: 10px;
    }

    .chatbot-input {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .chatbot-send-btn {
        width: 40px;
        height: 40px;
    }

    .chatbot-send-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .chatbot-widget {
        left: 12px;
        bottom: 12px;
    }

    .chatbot-button {
        width: 48px;
        height: 48px;
    }

    .chatbot-icon {
        width: 24px;
        height: 24px;
    }

    .chatbot-window {
        width: calc(100vw - 24px);
        max-width: none;
        left: 12px;
        right: 12px;
        bottom: 72px;
        max-height: 55vh;
    }

    .chatbot-messages {
        height: calc(55vh - 170px);
        min-height: 120px;
        max-height: 220px;
    }
}

/* ========== Light Mode ========== */
[data-theme="light"] .chatbot-window {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .chatbot-header {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chatbot-header-info h4 {
    color: #0f172a;
}

[data-theme="light"] .message-content {
    background: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}

[data-theme="light"] .chat-message.user .message-content {
    color: white;
}

[data-theme="light"] .chatbot-input-area {
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .chatbot-input {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

[data-theme="light"] .chatbot-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .quick-reply-btn {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #475569;
}

[data-theme="light"] .typing-indicator {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .typing-indicator span {
    background: rgba(0, 0, 0, 0.3);
}