/* ================== 全局变量与基础样式 ================== */
:root {
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 60px;
  --primary-color: #4c7cff;
  --primary-light: #e8f1fd;
  --light-bg: #f8f9fa;
  --dark-text: #16181a;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
  --danger-color: #e53e3e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.03);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1);
  --border-radius: 8px;
  --gap-md: 1rem;
  --gap-sm: 0.75rem;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  overflow: hidden;
  color: var(--dark-text);
  font-family: 'Segoe UI', 'SF Pro Display', -apple-system, sans-serif;
  background: #f7fafc;
}

/* ================== 侧边栏 ================== */
#sidebar {
  width: var(--sidebar-width);
  background: #f0f3ff;
  border-right: 1px solid var(--gray-300);
  height: 100%;
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}

#sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gray-300);
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary-color);
}

#sidebar.collapsed .logo {
  opacity: 0;
}

.collapse-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #718096;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapse-btn:hover {
  background: var(--gray-200);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: var(--dark-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s, border 0.2s;
  margin: 0 0.75rem;
  border: 1px solid transparent;
}

.quick-btn.active {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.quick-btn:hover:not(.active) {
  background: var(--gray-200);
}

.quick-btn i {
  font-size: 1rem;
  min-width: 20px;
  text-align: center;
}

.history-title {
  font-size: 0.75rem;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 1rem 0 0.5rem 0.75rem;
  padding-left: 0.25rem;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--dark-text);
  margin: 0 0.75rem;
  cursor: pointer;
  transition: background 0.2s;
}

.history-item:hover {
  background: var(--gray-200);
}

.history-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  flex: 1;
}

.history-actions {
  display: none;
  gap: 0.25rem;
}

.history-item:hover .history-actions {
  display: flex;
}

.action-btn {
  background: none;
  border: none;
  color: #718096;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
}

.action-btn:hover {
  color: var(--danger-color);
  background: rgba(229, 62, 62, 0.1);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--gray-300);
  position: relative;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 1rem;
}

.user-info {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--dark-text);
}

.user-menu-btn {
  background: none;
  border: none;
  color: #718096;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.user-menu-btn:hover {
  background: var(--gray-200);
}

.shortcut-icons {
  display: flex;
  gap: 2rem;
  justify-content: center;
}

.shortcut-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--gray-300);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #718096;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.shortcut-btn:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

#userDropdown {
  position: absolute;
  top: auto;
  bottom: 100%;
  right: 0;
  width: 200px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-300);
  padding: 0.5rem 0;
  z-index: 1000;
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--dark-text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.dropdown-item i {
  font-size: 1rem;
  min-width: 20px;
  text-align: center;
}

/* ================== 主内容区 ================== */
#main-content {
  flex: 1;
  overflow: hidden;
  background: #f7fafc;
  transition: margin-left 0.3s ease;
}

#main-content.sidebar-collapsed {
  margin-left: calc(var(--sidebar-collapsed-width) - var(--sidebar-width));
}

/* ================== 折叠状态隐藏 ================== */
#sidebar.collapsed .logo,
#sidebar.collapsed .user-info,
#sidebar.collapsed .quick-btn span,
#sidebar.collapsed .history-item-title,
#sidebar.collapsed .user-avatar,
#sidebar.collapsed .history-title {
  display: none;
}

#sidebar.collapsed .quick-btn,
#sidebar.collapsed .history-item {
  justify-content: center;
  padding: 0.75rem 0;
}

#sidebar.collapsed .user-section {
  justify-content: center;
}

#sidebar.collapsed .shortcut-icons {
  display: none;
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 60px;
  }
  #sidebar {
    width: var(--sidebar-width);
  }
}

/* ================== 更多功能页专属样式 ================== */

/* 筛选与搜索栏 */
#main-content .container-fluid.px-4.py-3 {
  border-bottom: 1px solid var(--gray-300);
  background: white;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

/* 筛选按钮 */
.btn-outline-primary {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-color);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: #3a56d4;
  border-color: #3a56d4;
}

.active-filter {
  background-color: var(--primary-color) !important;
  color: white !important;
  border-color: var(--primary-color) !important;
}

/* 搜索框样式 */
.input-group .form-control {
  border-radius: 50px;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.input-group .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}

.input-group .btn {
  background: transparent;
  border: none;
  cursor: pointer;
}

/* I NEED 按钮 */
#openSuggestModal {
  background-color: #e53e3e;
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
  min-width: 6rem;
}

.bc-w{
  background-color: white;
}

#openSuggestModal:hover {
  background-color: #c53030;
}

/* 功能卡片容器 */
#featuresGrid {
  row-gap: 1.5rem;
}

/* 卡片样式 */
.card {
  border: none;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.card-img-top {
  object-fit: cover;
  height: 130px;
  border-bottom: 1px solid var(--gray-200);
}

.card-body {
  padding: 1rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark-text);
}

.card-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #64748b;
  margin-bottom: 0.75rem;
}

/* 立即体验按钮 */
.btn-primary.rounded-pill {
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 50px;
}

/* 四列布局 */
@media (min-width: 992px) {
  .col-lg-3 {
    flex: 0 0 calc(25% - 0.75rem);
    max-width: calc(25% - 0.75rem);
  }
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(2px);
}

.modal-dialog {
  max-width: 540px;
  margin: 1rem;
}

.modal-content {
  border: none;
  border-radius: 12px;
  overflow: hidden;
}

.modal-content .bg-primary {
  padding: 1rem;
  text-align: center;
}

.modal-content .bg-primary h5 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-content .bg-primary p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* 表单字段 */
.form-label {
  font-weight: 500;
  color: var(--dark-text);
  margin-bottom: 0.5rem;
}

.form-control,
.form-select {
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  transition: border-color 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.2);
}

/* 按钮组 */
.modal-footer {
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
}

.btn-primary.flex-fill {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary.flex-fill:hover {
  background-color: #3a56d4;
  border-color: #3a56d4;
}

.btn-outline-secondary.flex-fill {
  border-color: var(--gray-300);
  color: var(--dark-text);
}

.btn-outline-secondary.flex-fill:hover {
  background-color: var(--gray-200);
}

/* 小屏优化 */
@media (max-width: 768px) {
  #main-content .container-fluid.px-4.py-3 {
    padding: 0.75rem 1rem;
  }

  .input-group,
  #openSuggestModal {
    min-width: auto;
    flex: 1;
  }

  .modal-dialog {
    max-width: 90%;
  }
}