.assistant-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.assistant-sidebar {
    width: 280px;
    min-width: 220px;
    max-width: 380px;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
}

.assistant-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar-top {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-top .return-link {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.sidebar-top .return-link:hover {
    color: white;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.new-chat-btn:active {
    transform: translateY(0);
}

.new-chat-btn svg {
    width: 16px;
    height: 16px;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-list::-webkit-scrollbar {
    width: 4px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.conversation-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    color: white;
}

.conversation-item .conv-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.5;
}

.conversation-item .conv-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-item .conv-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    white-space: nowrap;
}

.conversations-empty {
    padding: 24px 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

.sidebar-toggle-btn {
    position: absolute;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 24px;
    height: 48px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    color: white;
    background: rgba(30, 41, 59, 1);
}

.sidebar-toggle-btn.sidebar-collapsed {
    left: 0;
}

.sidebar-toggle-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.sidebar-toggle-btn.sidebar-collapsed svg {
    transform: rotate(180deg);
}

.assistant-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.assistant-header {
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.assistant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.assistant-header-info {
    flex: 1;
}

.assistant-header-info .name {
    font-size: 15px;
    font-weight: 600;
    color: white;
}

.assistant-header-info .status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.welcome-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-avatar {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.3);
}

.welcome-panel h2 {
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-panel .welcome-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 500px;
}

.suggestion-btn {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.suggestion-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    color: white;
    transform: translateY(-1px);
}

.msg-row {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: msgFadeIn 0.25s ease-out;
}

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

.msg-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-row.assistant {
    align-self: flex-start;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-top: 2px;
}

.msg-row.user .msg-avatar {
    background: rgba(59, 130, 246, 0.3);
}

.msg-row.assistant .msg-avatar {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.msg-row.user .msg-bubble {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-row.assistant .msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-bottom-left-radius: 4px;
}

.msg-bubble p {
    margin: 0 0 8px 0;
}

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

.msg-bubble code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Monaco', 'Menlo', monospace;
}

.msg-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.msg-bubble pre code {
    background: none;
    padding: 0;
}

.msg-bubble ul, .msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.msg-bubble li {
    margin-bottom: 4px;
}

.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
    color: #e2e8f0;
    margin: 12px 0 6px 0;
    line-height: 1.3;
}

.msg-bubble h1 { font-size: 17px; }
.msg-bubble h2 { font-size: 16px; }
.msg-bubble h3 { font-size: 15px; }

.msg-bubble h1:first-child, .msg-bubble h2:first-child, .msg-bubble h3:first-child {
    margin-top: 0;
}

.msg-bubble strong {
    color: white;
}

.msg-bubble a {
    color: #a78bfa;
    text-decoration: underline;
}

.msg-error .msg-bubble {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

.tool-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: #a78bfa;
    margin-bottom: 8px;
    animation: toolPulse 1.5s ease-in-out infinite;
}

@keyframes toolPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.tool-indicator.complete {
    animation: none;
    opacity: 0.6;
}

.tool-indicator .tool-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.tool-indicator.complete .tool-spinner {
    display: none;
}

.tool-indicator .tool-check {
    display: none;
}

.tool-indicator.complete .tool-check {
    display: inline;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    animation: msgFadeIn 0.2s ease-out;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: rgba(139, 92, 246, 0.5);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    max-width: 900px;
    margin: 0 auto;
}

.chat-input-field {
    flex: 1;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    color: white;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 150px;
    min-height: 44px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-input-field::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.chat-input-field:focus {
    border-color: rgba(139, 92, 246, 0.5);
}

.send-msg-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.send-msg-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

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

.send-msg-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-msg-btn svg {
    width: 18px;
    height: 18px;
}

.chat-input-hint {
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 6px;
}

@media (max-width: 768px) {
    .assistant-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .assistant-sidebar.mobile-open {
        transform: translateX(0);
    }

    .assistant-sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-toggle-btn {
        left: 0;
        position: fixed;
        z-index: 99;
    }

    .sidebar-toggle-btn:not(.sidebar-collapsed) {
        left: 280px;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .mobile-overlay.visible {
        display: block;
    }

    .msg-row {
        max-width: 95%;
    }

    .welcome-suggestions {
        grid-template-columns: 1fr;
    }

    .assistant-header {
        padding: 10px 14px;
    }

    .chat-input-area {
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .chat-area {
        padding: 12px;
        gap: 12px;
    }

    .msg-avatar {
        display: none;
    }

    .msg-row {
        max-width: 100%;
    }

    .welcome-panel {
        padding: 20px 12px;
    }

    .welcome-panel h2 {
        font-size: 18px;
    }
}
