/* 侧边栏样式 */
.sidebar {
  position: fixed;
  right: -300px;
  top: 0;
  width: 300px;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
  transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 100;
  padding: 25px;
  box-sizing: border-box;
  overflow-y: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dark-mode .sidebar {
  background-color: rgba(30, 30, 30, 0.95);
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
  right: 0;
}

.sidebar-toggle {
  position: fixed;
  right: 20px;
  top: 20px;
  width: 44px;
  height: 44px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.dark-mode .sidebar-toggle {
  background-color: rgba(255, 255, 255, 0.8);
  color: #222;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
  transform: scale(1.05);
  background-color: rgba(0, 0, 0, 0.9);
}

.dark-mode .sidebar-toggle:hover {
  background-color: white;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-mode .sidebar-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
}

.dark-mode .sidebar-header h3 {
  color: #f0f0f0;
}

.sidebar-close {
  cursor: pointer;
  font-size: 24px;
  transition: transform 0.3s ease;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.sidebar-close:hover {
  transform: rotate(90deg);
  background-color: rgba(0, 0, 0, 0.1);
}

.dark-mode .sidebar-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-section {
  margin-bottom: 25px;
}

.sidebar-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  padding-left: 12px;
}

.sidebar-section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #3498db;
}

.dark-mode .sidebar-section-title {
  color: #aaa;
}

.sidebar-links {
  border-left: 2px solid rgba(52, 152, 219, 0.3);
  padding-left: 10px;
}

.sidebar-links a {
  display: block;
  padding: 10px 0 10px 12px;
  color: #444;
  text-decoration: none;
  transition: all 0.3s ease;
  border-radius: 4px;
  margin-bottom: 3px;
  font-size: 0.95rem;
  position: relative;
  font-weight: 500;
}

.dark-mode .sidebar-links a {
  color: #ddd;
}

.sidebar-links a::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 0;
  height: 100%;
  width: 2px;
  background-color: #3498db;
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.sidebar-links a:hover {
  color: #2c3e50;
  background-color: rgba(52, 152, 219, 0.05);
  padding-left: 15px;
}

.dark-mode .sidebar-links a:hover {
  color: #ffffff;
  background-color: rgba(52, 152, 219, 0.1);
}

.sidebar-links a:hover::before {
  transform: scaleY(1);
}

.sidebar-links a:active {
  transform: translateX(2px);
}

/* 搜索框样式 */
.sidebar-search {
  margin: 15px 10px;
  padding: 0 10px;
  width: calc(100% - 70px);
  box-sizing: border-box;
}

.search-container {
  display: flex;
  height: 36px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-color, #e4e4e4);
  transition: all 0.3s;
  background-color: var(--bg-color, #fff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  width: 100%;
}

.search-container:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.search-input {
  flex: 1;
  padding: 0 15px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-color, #333);
  min-width: 0; /* 防止输入框溢出 */
}

.search-input::placeholder {
  color: var(--placeholder-color, #999);
}

.search-button {
  width: 80px;
  background: #f0f0f0;
  color: #333;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 关键修复：继承容器的圆角 */
  border-radius: 0 18px 18px 0;
  /* 防止按钮边框溢出 */
  margin: -1px -1px -1px 0;
  /* 确保按钮内文字不会溢出 */
  overflow: hidden;
}

.search-button:hover {
  background: #4e6ef2;
  color: white;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .search-container {
    background-color: var(--bg-color, #2d2d2d);
    border-color: var(--border-color, #444);
  }
  
  .search-input {
    color: var(--text-color, #ddd);
  }
  
  .search-button {
    background: #444;
    color: #ddd;
  }
  
  .search-button:hover {
    background: #2c3e50;
    color: white;
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .sidebar {
    width: 85%;
    right: -85%;
    padding: 20px;
  }
  
  .sidebar-toggle {
    width: 40px;
    height: 40px;
  }
}