/* 通用布局样式 - Claymorphism */

/* 通用工具类 */
.hidden {
  display: none !important;
}

/* 页面容器 */
.container {
  max-width: 1280px; /* 稍宽一些，展示卡片更从容 */
  margin: 0 auto;
  padding: var(--spacing-xl);
}

/* 头部导航 - 悬浮胶囊风格 */
.header {
  background: transparent;
  box-shadow: none;
  position: sticky;
  top: var(--spacing-md);
  z-index: 100;
  pointer-events: none; /* 让布局不阻挡下方点击，内部元素开启 */
}

.header-content {
  pointer-events: auto;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(240, 243, 249, 0.8); /* 半透明背景 */
  backdrop-filter: blur(20px); /* 毛玻璃效果 */
  border-radius: var(--radius-full); /* 胶囊形状 */
  box-shadow: var(--shadow-clay-out-sm);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  letter-spacing: -0.5px;
}

/* 可以加一个简单的 Logo 图标 */
.logo::before {
  content: '📚';
  margin-right: 8px;
  font-size: 24px;
}

.nav {
  display: flex;
  gap: var(--spacing-md);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 700;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
  color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.5);
}

.nav-link.active {
  background-color: var(--bg-body);
  color: var(--primary-color);
  box-shadow: var(--shadow-clay-in); /* 激活状态为凹陷 */
}

/* 页面标题 */
.page-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xl);
  text-align: center;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

/* 网格布局 */
.grid {
  display: grid;
  gap: var(--spacing-xl);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  
  .header {
    top: 0;
  }
  
  .header-content {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* 提示消息 - 悬浮胶囊 */
.toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background-color: var(--text-primary);
  color: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  font-weight: 600;
  animation: slideInDown 0.3s ease-out;
}

.toast-success {
  background-color: var(--success-color);
}

.toast-error {
  background-color: var(--error-color);
}

@keyframes slideInDown {
  from {
    transform: translate(-50%, -20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}
