/**
 * TheNexGenCoder Bot Styles
 * Sleek, Professional AI Assistant
 */

.nexgen-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========================================================================
   1. LAUNCHER BUTTON
   ======================================================================== */
.chat-launcher-btn {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1.5px solid rgba(0, 240, 255, 0.5);
    background: #0b0f22;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 240, 255, 0.22);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    padding: 0;
}

.chat-launcher-btn:hover {
    transform: scale(1.08);
    border-color: #00f0ff;
    box-shadow: 0 12px 35px rgba(0, 240, 255, 0.35), 0 0 30px rgba(0, 240, 255, 0.4);
}

.chat-launcher-btn:active {
    transform: scale(0.95);
}

.launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.launcher-icon-close {
    display: none;
}

.nexgen-chat-widget.is-open .launcher-icon-open {
    display: none;
}

.nexgen-chat-widget.is-open .launcher-icon-close {
    display: flex;
}

.nexgen-chat-widget.is-open .chat-launcher-btn {
    background: #181d33;
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

/* ========================================================================
   2. CHAT WINDOW CONTAINER
   ======================================================================== */
.chat-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 375px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 110px);
    background: rgba(9, 13, 27, 0.96);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 240, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.nexgen-chat-widget.is-open .chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: rgba(14, 20, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #090d1b;
}

.chat-header-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: -0.2px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.chat-header-status {
    color: #94a3b8;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* ========================================================================
   3. MESSAGES STREAM
   ======================================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: chatMsgFadeIn 0.25s ease-out;
}

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

.chat-msg.user {
    align-self: flex-end;
}

.chat-bubble {
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 0.83rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-msg.bot .chat-bubble {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid #00f0ff;
    color: #f1f5f9;
    border-top-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.chat-msg-time {
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 3px;
    padding: 0 4px;
}

.chat-msg.user .chat-msg-time {
    text-align: right;
}

/* Typing Indicator Animation */
.chat-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    width: fit-content;
}

.typing-sparkle {
    color: #00f0ff;
    font-size: 0.85rem;
}

.typing-text {
    font-size: 0.74rem;
    color: #94a3b8;
    margin-right: 2px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #00f0ff;
    opacity: 0.4;
    animation: typingBlink 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; }

/* Markdown Lists & Links */
.chat-bullet-list {
    margin: 4px 0 4px 16px;
    padding: 0;
    list-style-type: disc;
}

.chat-bullet-list li {
    margin-bottom: 3px;
    line-height: 1.45;
}

.chat-link {
    color: #00f0ff !important;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    transition: color 0.2s;
}

.chat-link:hover {
    color: #38bdf8 !important;
}

/* ========================================================================
   4. QUICK CHIPS
   ======================================================================== */
.chat-quick-chips {
    padding: 7px 12px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.25);
}

.chat-quick-chips::-webkit-scrollbar {
    height: 3px;
}

.chat-quick-chips::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

.chat-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: #94a3b8;
    font-size: 0.72rem;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-chip:hover {
    background: rgba(0, 240, 255, 0.12);
    border-color: rgba(0, 240, 255, 0.4);
    color: #00f0ff;
    transform: translateY(-1px);
}

/* ========================================================================
   5. INPUT FORM
   ======================================================================== */
.chat-input-area {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 15, 30, 0.95);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 0.83rem;
    outline: none;
    transition: all 0.2s;
}

.chat-input:focus {
    border-color: #00f0ff;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.chat-input::placeholder {
    color: #64748b;
    font-size: 0.78rem;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, #00f0ff 0%, #2563eb 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

/* Footer Brand */
.chat-footer-brand {
    padding: 5px 12px;
    font-size: 0.67rem;
    color: #64748b;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    background: rgba(6, 9, 20, 0.95);
}

.chat-wa-link {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.chat-wa-link:hover {
    color: #22c55e;
}

/* ========================================================================
   6. KEYFRAME ANIMATIONS
   ======================================================================== */
@keyframes chatMsgFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingBlink {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.3;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================================================
   7. RESPONSIVE MOBILE STYLES
   ======================================================================== */
@media (max-width: 576px) {
    .nexgen-chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-launcher-btn {
        width: 50px;
        height: 50px;
    }

    .chat-window {
        bottom: 64px;
        right: 0;
        width: calc(100vw - 28px);
        height: calc(100vh - 100px);
        max-height: 480px;
        border-radius: 14px;
    }
}
