/* ===== Global ===== */
html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #0d1117;
    color: #e6edf3;
    overflow: hidden;
}

/* ===== Chat Layout ===== */
.chat-layout {
    height: 100vh;
    overflow: hidden;
}

/* ===== Sidebar ===== */
.chat-sidebar-wrapper {
    width: 280px;
    min-width: 280px;
    background: #161b22;
    border-right: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.chat-sidebar {
    background: #161b22;
}

.sidebar-header {
    border-bottom: 1px solid #30363d;
}

.sidebar-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8b949e;
}

.sidebar-item {
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 0.875rem;
}

.sidebar-item:hover {
    background: #21262d;
}

.sidebar-item.active {
    background: #1f6feb33;
    color: #58a6ff;
}

.sidebar-item-actions {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.sidebar-item:hover .sidebar-item-actions {
    opacity: 1;
}

.sidebar-footer {
    background: #161b22;
}

/* ===== Chat Main ===== */
.chat-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    background: #0d1117;
}

.chat-header {
    background: #161b22;
    min-height: 52px;
}

.chat-messages {
    background: #0d1117;
}

/* ===== Chat Bubbles ===== */
.chat-message {
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.6;
    word-break: break-word;
}

.chat-bubble-user {
    background: #1f6feb;
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.chat-bubble-assistant {
    background: #161b22;
    border: 1px solid #30363d;
    border-bottom-left-radius: 0.25rem;
}

.chat-bubble-error {
    background: #3d1117;
    border-color: #f8514966;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble pre {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 0.5rem;
    padding: 0.75rem;
    overflow-x: auto;
    font-size: 0.85rem;
}

.chat-bubble code {
    font-size: 0.85rem;
}

.chat-bubble pre code {
    background: transparent;
    padding: 0;
}

.chat-stats {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ===== Streaming ===== */
.streaming-cursor {
    animation: blink 1s step-end infinite;
    color: #58a6ff;
    font-weight: bold;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* ===== Input Area ===== */
.chat-input-area {
    background: #0d1117;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.chat-input-area textarea {
    resize: none;
    min-height: 44px;
    max-height: 200px;
    border-radius: 0.75rem;
}

.chat-input-area .btn {
    border-radius: 0.75rem;
}

/* ===== Welcome ===== */
.chat-welcome {
    opacity: 0.8;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #0d1117;
}

.login-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

/* ===== Responsive ===== */
@media (max-width: 767.98px) {
    .chat-sidebar-wrapper {
        position: fixed;
        left: -280px;
        top: 0;
        z-index: 1050;
        transition: left 0.25s ease;
    }

    .chat-sidebar-wrapper.open {
        left: 0;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }

    .chat-bubble {
        max-width: 95%;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* ===== MudBlazor dark overrides ===== */
.mud-dialog .mud-dialog-content {
    background: #161b22;
}

.mud-dialog .mud-dialog-actions {
    background: #161b22;
}
