* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #f7f7f8;
}

.container {
  display: flex;
  height: 100vh;
}

/* Left Sidebar */
.sidebar {
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed {
  margin-left: -280px;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  gap: 10px;
}

.new-chat-btn {
  flex: 1;
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.new-chat-btn:hover {
  background: #1d4ed8;
}

.collapse-btn {
  padding: 12px 16px;
  background: #f3f4f6;
  color: #4b5563;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.2s;
}

.collapse-btn:hover {
  background: #e5e7eb;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.chat-item {
  padding: 12px 16px;
  margin-bottom: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-item:hover {
  background: #f3f4f6;
}

.chat-item.active {
  background: #e5e7eb;
}

.chat-item-title {
  font-size: 14px;
  color: #1f2937;
  font-weight: 500;
  margin-bottom: 4px;
}

.chat-item-preview {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Chat Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.chat-header {
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.expand-btn {
  padding: 8px 12px;
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #4b5563;
  transition: background 0.2s;
  position: absolute;
  left: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.expand-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.expand-btn:hover {
  background: #e5e7eb;
}

.main-content.sidebar-collapsed .expand-btn {
  opacity: 1;
  pointer-events: auto;
}

.main-content.sidebar-collapsed .chat-header span {
  margin-left: 50px;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.message {
  margin-bottom: 20px;
  max-width: 800px;
}

.message.user {
  margin-left: auto;
}

.message-role {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 8px;
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  font-size: 14px;
}

.message.assistant .message-content {
  background: #f3f4f6;
  color: #1f2937;
}

.message.user .message-content {
  background: #2563eb;
  color: white;
}

/* Input Area */
.input-area {
  border-top: 1px solid #e5e5e5;
  padding: 20px;
  background: #ffffff;
}

.input-container {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: text;
}

.input-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #1f2937;
  resize: none;
  max-height: 200px;
}

.send-btn {
  padding: 8px 16px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 10px;
}

.send-btn:hover {
  background: #1d4ed8;
}

.send-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 4px;
  z-index: 1000;
  display: none;
  min-width: 160px;
}

.context-menu.visible {
  display: block;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}

.context-menu-item:hover {
  background: #f3f4f6;
}

.context-menu-item.danger {
  color: #dc2626;
}

.context-menu-item.danger:hover {
  background: #fee2e2;
}