/* ========== CHAT WIDGET ========== */
#chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* ── Toggle button ── */
#chat-widget-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1F6FEB;
    border: none;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 4px 20px rgba(31, 111, 235, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#chat-widget-btn:hover  { transform: scale(1.08); box-shadow: 0 6px 24px rgba(31,111,235,0.65); }
#chat-widget-btn:active { transform: scale(0.96); }
#chat-widget-btn img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
}

/* ── Chat window ── */
#chat-widget-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 320px;
    height: 490px;
    background: #0D1117;
    border: 1px solid #30363D;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    transform-origin: bottom right;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.18s ease;
}
#chat-widget-window.chat-widget-hidden {
    transform: scale(0.75);
    opacity: 0;
    pointer-events: none;
}

/* ── Header ── */
#chat-widget-header {
    background: #161B22;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #30363D;
    flex-shrink: 0;
}
#chat-widget-header-title {
    display: flex;
    align-items: center;
    gap: 9px;
}
#chat-widget-header-title img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
#chat-widget-header-title span {
    color: #FFFFFF;
    font-weight: 600;
    font-size: 14px;
}
#chat-widget-header-status {
    font-size: 11px;
    color: #3FB950;
    font-weight: 400;
    display: block;
    margin-top: 1px;
}
#chat-widget-close {
    background: none;
    border: none;
    color: #6E7681;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}
#chat-widget-close:hover { color: #FFFFFF; background: #21262D; }

/* ── Messages area ── */
#chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    scrollbar-width: thin;
    scrollbar-color: #30363D transparent;
}
#chat-widget-messages::-webkit-scrollbar       { width: 4px; }
#chat-widget-messages::-webkit-scrollbar-track { background: transparent; }
#chat-widget-messages::-webkit-scrollbar-thumb { background: #30363D; border-radius: 2px; }

/* ── Bubbles ── */
.chat-msg {
    max-width: 84%;
    padding: 9px 12px;
    border-radius: 13px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
    animation: msg-in 0.2s ease;
}
@keyframes msg-in {
    from { opacity: 0; transform: translateY(7px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot {
    background: #161B22;
    color: #C9D1D9;
    border-bottom-left-radius: 3px;
    align-self: flex-start;
}
.chat-msg.user {
    background: #1F6FEB;
    color: #FFFFFF;
    border-bottom-right-radius: 3px;
    align-self: flex-end;
}
.chat-msg a          { color: #58A6FF; text-decoration: none; }
.chat-msg a:hover    { text-decoration: underline; }
.chat-msg b          { color: #FFFFFF; font-weight: 600; }
.chat-msg code {
    background: rgba(255,255,255,0.1);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 11.5px;
    font-family: 'Courier New', monospace;
}

/* ── Typing indicator ── */
.chat-typing-indicator {
    background: #161B22;
    align-self: flex-start;
    padding: 10px 14px;
    border-radius: 13px;
    border-bottom-left-radius: 3px;
    display: flex;
    gap: 5px;
    align-items: center;
    animation: msg-in 0.2s ease;
}
.chat-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #6E7681;
    border-radius: 50%;
    animation: dot-bounce 1.2s infinite;
}
.chat-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30%            { opacity: 1;    transform: translateY(-4px); }
}

/* ── Quick reply chips ── */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    max-width: 98%;
    padding: 4px 0 2px;
    animation: msg-in 0.22s ease;
}
.chat-option-btn {
    background: transparent;
    border: 1px solid #30363D;
    color: #8B949E;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
    transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s;
}
.chat-option-btn:hover {
    border-color: #1F6FEB;
    background: rgba(31, 111, 235, 0.12);
    color: #FFFFFF;
}
.chat-option-btn:active {
    transform: scale(0.96);
    background: rgba(31, 111, 235, 0.22);
}

/* ── Input area ── */
#chat-widget-input-area {
    padding: 9px 12px;
    background: #161B22;
    border-top: 1px solid #30363D;
    display: flex;
    gap: 7px;
    align-items: center;
    flex-shrink: 0;
}
#chat-widget-input {
    flex: 1;
    background: #0D1117;
    border: 1px solid #30363D;
    border-radius: 8px;
    padding: 7px 10px;
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    outline: none;
    transition: border-color 0.18s;
    min-width: 0;
}
#chat-widget-input::placeholder { color: #484F58; }
#chat-widget-input:focus         { border-color: #1F6FEB; }

#chat-widget-send {
    background: #1F6FEB;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
#chat-widget-send:hover    { background: #388BFD; }
#chat-widget-send:active   { background: #1158C7; }
#chat-widget-send:disabled { background: #21262D; cursor: not-allowed; opacity: 0.45; }

/* ── Mobile ── */
@media (max-width: 480px) {
    #chat-widget { bottom: 16px; right: 16px; }
    #chat-widget-window {
        width: calc(100vw - 32px);
        height: 65vh;
        max-height: 540px;
        bottom: 70px;
    }
}
