/* Sidebar Styles */
.sidebar-wrapper {
  position: relative;
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 280px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  z-index: 100;
}

/* 悬浮收起按钮 */
.sidebar-collapse-btn {
  position: absolute;
  top: 50%;
  right: -12px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  border: 1px solid #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  z-index: 10;
}

.sidebar-collapse-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
  transform: translateY(-50%) scale(1.1);
}

/* 收起状态 */
.sidebar-container.collapsed .sidebar {
  width: 60px;
}

.sidebar-container.collapsed .sidebar-header {
  padding: 1rem 0.5rem;
}

.sidebar-container.collapsed .app-logo {
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-container.collapsed .app-name {
  font-size: 0.75rem;
  writing-mode: vertical-lr;
  text-orientation: mixed;
}

.sidebar-container.collapsed .header-actions {
  margin-top: 0.5rem;
}

.sidebar-container.collapsed .session-item {
  padding: 0.5rem;
  justify-content: center;
}

.sidebar-container.collapsed .session-info {
  display: none;
}

.sidebar-container.collapsed .session-actions {
  display: none;
}

.sidebar-container.collapsed .session-item::before {
  content: '💬';
  font-size: 1.2rem;
}

.sidebar-container.collapsed .session-item.active::before {
  content: '🗨️';
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(10px);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.logo-icon {
  font-size: 1.5rem;
  color: #667eea;
}

.app-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.new-chat-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.2);
  color: #667eea;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.new-chat-btn:hover {
  background: rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.session-item {
  padding: 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid transparent;
}

.session-item:hover {
  background: rgba(241, 245, 249, 0.8);
  border-color: rgba(226, 232, 240, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.session-item.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.session-item.active .session-title {
  color: white;
}

.session-item.active .session-preview,
.session-item.active .session-time {
  color: rgba(255, 255, 255, 0.8);
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-preview {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.session-time {
  font-size: 0.75rem;
  color: #94a3b8;
}

.session-actions {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.session-item.active .session-actions {
  opacity: 1;
}

.session-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 12px;
}

.session-action-btn:hover {
  background: rgba(100, 116, 139, 0.2);
  color: #475569;
}

.session-item.active .session-action-btn {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

.session-item.active .session-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

.session-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.session-item.active .session-action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.session-edit {
  padding: 0.25rem 0;
}

.edit-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.edit-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Scrollbar Styles */
.sessions-list::-webkit-scrollbar {
  width: 4px;
}

.sessions-list::-webkit-scrollbar-track {
  background: transparent;
}

.sessions-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.sessions-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar-container.open .sidebar-wrapper {
    transform: translateX(0);
  }
  
  .sidebar-collapse-btn {
    display: none; /* 移动端不显示收起按钮 */
  }
} 