/* Chat Widget - Dark Theme */
.chat-bubble {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 999;
}
.chat-bubble:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(37,99,235,0.5); }
.chat-bubble.active { 
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(220,38,38,0.4);
}

.chat-panel {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 380px;
    height: 520px;
    background: #1e293b;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    display: none;
    flex-direction: column;
    z-index: 998;
    overflow: hidden;
    border: 1px solid #334155;
    animation: slideUp 0.25s ease-out;
}
.chat-panel.open { display: flex; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-panel-header {
    background: linear-gradient(135deg, #0f172a, #1e3a5f);
    color: #e2e8f0;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.chat-panel-header .title {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.chat-panel-header .title span { opacity: 0.7; font-size: 0.75rem; font-weight: 400; }
.chat-panel-header .close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #e2e8f0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.chat-panel-header .close-btn:hover { background: rgba(255,255,255,0.25); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #0f172a;
}

.chat-msg {
    max-width: 85%;
    padding: 0.6rem 0.85rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    animation: msgIn 0.2s ease-out;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
    align-self: flex-start;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-bottom-left-radius: 4px;
}
.chat-msg.system {
    align-self: center;
    background: #1e3a5f;
    color: #94a3b8;
    font-size: 0.75rem;
    font-style: italic;
    border-radius: 8px;
    max-width: 90%;
}

.chat-msg .msg-time {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 0.2rem;
    display: block;
}
.chat-msg.user .msg-time { text-align: right; }

.chat-msg pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.78rem;
    overflow-x: auto;
    margin: 0.3rem 0;
    white-space: pre-wrap;
    word-break: break-all;
}
.chat-msg code {
    background: #334155;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.8rem;
    color: #e2e8f0;
}
.chat-msg.user code { background: rgba(255,255,255,0.15); color: #fff; }

.chat-input-area {
    display: flex;
    padding: 0.6rem;
    gap: 0.5rem;
    border-top: 1px solid #334155;
    background: #1e293b;
    flex-shrink: 0;
}
.chat-input-area input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid #475569;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    background: #0f172a;
    color: #e2e8f0;
}
.chat-input-area input:focus { border-color: #2563eb; }
.chat-input-area input::placeholder { color: #64748b; }
.chat-input-area button {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}
.chat-input-area button:hover { background: #1d4ed8; }
.chat-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-typing {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.75rem;
    align-self: flex-start;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}
.chat-typing .dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.2); }
}

/* Quick prompts */
.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem 0.25rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
.quick-prompt {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    border: 1px solid #475569;
    background: #0f172a;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.15s;
    white-space: nowrap;
}
.quick-prompt:hover { border-color: #2563eb; color: #60a5fa; background: #1e3a5f; }

@media (max-width: 480px) {
    .chat-panel {
        width: calc(100% - 2rem);
        height: 60vh;
        bottom: 4.5rem;
        right: 1rem;
    }
}
