/* ============================================================
   AI COPILOT CHAT — Glassmorphism Theme
   ============================================================ */

/* ── Floating Action Button (FAB) ── */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #3fb950, #2ea043);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(46, 160, 67, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 28px rgba(46, 160, 67, 0.5);
}

.chat-fab.hidden {
    display: none;
}

/* ── Chat Window ── */
.chat-window {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 120px);
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 9000;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Chat Header ── */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px 16px 0 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(90deg, #58a6ff, #a371f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.chat-close-btn:hover {
    color: #ff7b72;
}

/* ── Chat Messages Area ── */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* ── Bubbles ── */
.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeInBubble 0.3s ease;
}

@keyframes fadeInBubble {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble.ai {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #e6edf3;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-bubble.user {
    background: rgba(63, 185, 80, 0.15);
    border: 1px solid rgba(63, 185, 80, 0.3);
    color: #e6edf3;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Markdown styling inside AI bubble */
.chat-bubble.ai strong {
    color: #58a6ff;
    font-weight: 600;
}

.chat-bubble.ai ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chat-bubble.ai li {
    margin-bottom: 4px;
}

.chat-bubble.ai p {
    margin: 0 0 8px 0;
}

.chat-bubble.ai p:last-child {
    margin: 0;
}

/* ── Typing Indicator ── */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: transparent;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #8b949e;
    border-radius: 50%;
    animation: typingBounce 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 typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ── Chat Input Area ── */
.chat-input-area {
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    border-radius: 0 0 16px 16px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    color: #e6edf3;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: #58a6ff;
}

.chat-send-btn {
    background: #3fb950;
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.chat-send-btn:hover {
    background: #2ea043;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #1f4f26;
    color: #8b949e;
    cursor: not-allowed;
    transform: none;
}

/* ── Mobile responsiveness ── */
@media (max-width: 600px) {
    .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 84px;
    }

    .chat-fab {
        bottom: 16px;
        right: 16px;
        padding: 12px 16px;
    }
}