/* Chat Widget Styles */
.chat-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget-btn:hover {
    transform: scale(1.1);
}

.chat-widget-window {
    position: fixed;
    bottom: 10px;
    right: 30px;
    width: 350px;
    height: 450px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s ease;
}

.chat-widget-window.active {
    display: flex;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(79, 70, 229, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.bot {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-message.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 10px 15px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--primary);
}

.chat-send-btn {
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.1);
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    margin-bottom: 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Markdown Styles inside chat */
.chat-message.bot p {
    margin-bottom: 8px;
}

.chat-message.bot p:last-child {
    margin-bottom: 0;
}

.chat-message.bot ul {
    margin-left: 20px;
    margin-bottom: 8px;
}

.chat-message.bot strong {
    color: #fff;
    font-weight: 600;
}

.chat-message.bot a {
    color: var(--primary);
    text-decoration: underline;
}

/* ===============================
   MOBILE CHAT UI (≤ 768px)
   =============================== */
@media (max-width: 768px) {

    /* Floating Button */
    .chat-widget-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }

    /* Chat Window becomes FULLSCREEN */
    .chat-widget-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 80vh;
        border-radius: 0;
        transform-origin: bottom center;
        background: rgba(15, 23, 42, 0.98);
    }

    /* Slide-up animation (mobile feel) */
    .chat-widget-window.active {
        animation: slideUp 0.25s ease-out;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Header */
    .chat-header {
        padding: 16px;
        position: sticky;
        top: 0;
        z-index: 10;
        backdrop-filter: blur(10px);
    }

    .chat-header h4 {
        font-size: 1rem;
    }

    /* Chat body */
    .chat-body {
        padding: 15px;
        gap: 12px;
    }

    /* Messages */
    .chat-message {
        max-width: 90%;
        font-size: 0.95rem;
        padding: 12px 14px;
        border-radius: 18px;
    }

    .chat-message.bot {
        border-bottom-left-radius: 4px;
    }

    .chat-message.user {
        border-bottom-right-radius: 4px;
    }

    /* Footer sticks to bottom */
    .chat-footer {
        padding: 12px;
        position: sticky;
        bottom: 0;
        background: rgba(15, 23, 42, 0.95);
    }

    /* Input */
    .chat-input {
        padding: 12px 16px;
        font-size: 1rem;
        border-radius: 30px;
    }

    /* Send button bigger */
    .chat-send-btn {
        width: 45px;
        height: 45px;
    }

    /* Typing indicator */
    .typing-indicator {
        padding: 10px 14px;
    }

    /* Markdown tweaks for mobile */
    .chat-message.bot h1 {
        font-size: 1.2rem;
    }

    .chat-message.bot h2 {
        font-size: 1.1rem;
    }

    .chat-message.bot h3 {
        font-size: 1rem;
    }

    .chat-message.bot pre {
        font-size: 0.85rem;
        overflow-x: auto;
    }
}