/* 侧边栏遮罩 */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 侧边栏 */
.groups-sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100vh;
  background: #1a1a1a;
  z-index: 1000;
  transition: left 0.3s;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.groups-sidebar.active {
  left: 0;
}

/* 侧边栏头部 */
.groups-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.groups-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
}

.groups-header .icon-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.groups-header .icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 侧边栏底部 */
.groups-footer {
  padding: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 新建按钮 */
.btn-new-group {
  width: 100%;
  padding: 12px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.btn-new-group:hover {
  background: var(--primary-hover);
}

/* 分组列表 */
.groups-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 15px 15px;
}

.group-item {
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.2s;
  position: relative;
}

.group-item:hover {
  background: var(--bg-hover);
}

.group-item.active {
  background: var(--primary-color);
  color: white;
}

.group-item.active .group-item-name {
  color: white;
}

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

.group-item-content {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 12px 15px;
  cursor: pointer;
  min-width: 0;
}

.group-item-icon {
  flex-shrink: 0;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.group-item.active .group-item-icon {
  color: white;
}

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

.group-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.group-item-time {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 三点菜单按钮 */
.group-item-menu {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.group-item-menu:hover {
  background: rgba(0, 0, 0, 0.1);
}

.group-item.active .group-item-menu {
  color: white;
}

.group-item.active .group-item-menu:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 分组菜单 */
.group-menu {
  position: fixed;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  min-width: 150px;
  overflow: hidden;
  display: none;
}

.group-menu.active {
  display: block;
}

.group-menu-item {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.group-menu-item:hover {
  background: var(--bg-secondary);
}

.group-menu-item.danger {
  color: #ff4444;
}

.group-menu-item.danger:hover {
  background: #fff0f0;
}

/* 下拉菜单 */
.group-dropdown {
  position: absolute;
  right: 10px;
  top: 45px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  min-width: 120px;
  overflow: hidden;
  display: none;
}

.group-dropdown.active {
  display: block;
}

.group-dropdown-item {
  padding: 10px 15px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.group-dropdown-item:hover {
  background: var(--bg-secondary);
}

.group-dropdown-item.delete {
  color: #ff4444;
}

.group-dropdown-item.delete:hover {
  background: #fff0f0;
}

/* 重命名对话框 */
.rename-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 1002;
  width: 90%;
  max-width: 400px;
  display: none;
}

.rename-dialog.active {
  display: block;
}

.rename-dialog-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.rename-dialog-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.rename-dialog-body {
  padding: 20px;
}

.rename-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.rename-input:focus {
  border-color: var(--primary-color);
}

.rename-dialog-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.rename-dialog-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.rename-dialog-btn.cancel {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.rename-dialog-btn.cancel:hover {
  background: var(--bg-hover);
}

.rename-dialog-btn.confirm {
  background: var(--primary-color);
  color: white;
}

.rename-dialog-btn.confirm:hover {
  background: var(--primary-hover);
}
