/* ===================================================================
   layout.css — 页面大结构及响应式
   完全对齐 base.html 的实际 DOM 结构
   =================================================================== */

/* 主容器 */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
  align-items: start;
}

/* ---------- Header ---------- */
header {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: var(--z-nav);
  margin-bottom: 30px;
  overflow: hidden;          /* 新增加：配合闪烁动画 */
}

/* 新增加：原来 header 的背景闪烁效果 */
header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.site-logo {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: inline-block;
  background: linear-gradient(45deg, #fff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: opacity 0.2s;
}

.site-logo:hover {
  opacity: 0.9;

}

.logo p {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 300;
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: var(--z-drawer-toggle);
}

.mobile-menu-toggle span {
  width: 25px;
  height: 3px;
  background: white;
  border-radius: 2px;
  transition: var(--transition);
}

.social-icons {
  display: flex;
  gap: 15px;
}

.social-icons a {
  color: white;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

.social-icons a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px);
}

/* 桌面导航 */
.main-nav.desktop-nav ul {
  display: flex;
  gap: 2px;
  list-style: none;
  justify-content: center;
  flex-wrap: wrap;
}

.main-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  border-radius: 25px;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.95rem;
}

.main-nav .nav-link:hover,
.main-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: sticky;
  top: 30px;
  align-self: start;
  background: linear-gradient(145deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 12px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: fit-content;
  z-index: var(--z-sidebar);
}

.sidebar > * {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin: 0 4px;
  width: calc(100% - 8px);
}

.profile-section { text-align: center; }


.search-box { position: relative; }
.search-options { display: flex; margin-bottom: 12px; border-radius: 20px; background: var(--bg-secondary); padding: 4px; }
.search-option {
  flex: 1; padding: 8px 12px; border: none; background: transparent; border-radius: 16px;
  cursor: pointer; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); transition: var(--transition);
}
.search-option.active { background: var(--primary-color); color: white; }
.search-option:hover:not(.active) { background: var(--bg-tertiary); }
.search-input-group { position: relative; }
.search-input-group input {
  width: 100%; padding: 12px 45px 12px 16px; border: 1.5px solid var(--border-color);
  border-radius: 24px; font-size: 0.95rem; outline: none; transition: var(--transition);
  background: var(--bg-primary); color: var(--text-primary);
}
.search-input-group input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.search-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--primary-color); border: none; color: white; width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; transition: var(--transition);
}
.search-btn:hover { background: var(--secondary-color); transform: translateY(-50%) scale(1.05); }

.menu h3 { font-size: 1.2rem; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--primary-color); }
.menu ul { list-style: none; }
.menu li a {
  display: flex; align-items: center; padding: 10px 14px; color: var(--text-secondary); text-decoration: none;
  border-radius: var(--radius-md); transition: var(--transition); font-weight: 500; font-size: 0.95rem;
}
.menu li a:hover { background: var(--bg-secondary); color: var(--primary-color); transform: translateX(4px); }
.menu li a.active { background: var(--primary-color); color: white; }


/* ---------- 主内容区 ---------- */
.main-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  box-shadow: var(--shadow-md);
}

/* ---------- Footer ---------- */
footer {
  grid-column: 1 / -1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 15px 25px;
  margin-top: 30px;
}
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.footer-copyright { color: var(--text-secondary); font-size: 0.9rem; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; }
.footer-links a:hover { color: var(--primary-color); }

/* ---------- 浮动按钮 ---------- */
.floating-action-buttons {
  position: fixed;
  right: 25px;
  bottom: 25px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: var(--z-drawer);
}
.floating-action-buttons .fab {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); font-size: 1.2rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.floating-action-buttons .fab:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}
.fab-tooltip {
  position: absolute; right: 65px; background: rgba(0, 0, 0, 0.85); color: white;
  padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  white-space: nowrap; opacity: 0; transform: translateX(15px);
  transition: all 0.3s; pointer-events: none; backdrop-filter: blur(10px);
}
.fab:hover .fab-tooltip { opacity: 1; transform: translateX(0); }

/* 返回顶部按钮初始隐藏 */
.back-to-top {
  opacity: 0; visibility: hidden; transform: translateY(30px) scale(0.8); transition: all 0.4s;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* ---------- 底部抽屉菜单 ---------- */
.mobile-menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: var(--z-drawer-overlay); opacity: 0; visibility: hidden; transition: all 0.3s; }
.mobile-menu-overlay.active { opacity: 1; visibility: visible; }
.bottom-sheet-menu {
  position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-card);
  border-radius: 20px 20px 0 0; z-index: var(--z-drawer); box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  max-height: 80vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.4s;
}
.bottom-sheet-menu.active { transform: translateY(0); }
.bottom-sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--border-color); }
.bottom-sheet-handle { width: 40px; height: 4px; background: #ddd; border-radius: 2px; }
.bottom-sheet-close { background: none; border: none; cursor: pointer; color: var(--text-secondary); }
.bottom-sheet-nav a { display: flex; align-items: center; padding: 18px 20px; color: var(--text-primary); text-decoration: none; border-bottom: 1px solid var(--border-color); font-weight: 500; }
.bottom-sheet-nav a:hover { background: var(--bg-secondary); }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .container {
    grid-template-columns: 1fr;
    display: block;           /* 与 base.html 内联修复保持一致 */
  }
  .sidebar {
    display: none;            /* 移动端默认隐藏，由 JS 控制 */
  }
  .main-content {
    width: 100%;
  }
  .mobile-menu-toggle {
    display: flex;
  }
  .desktop-nav {
    display: none;
  }
  .mobile-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
    order: 2;
    margin-top: 8px
  }
}

@media (max-width: 768px) {
  header {
    padding: 12px 15px;
    margin-bottom: 15px;
  }

  .header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .logo {
    flex: 1;
    text-align: left;
  }

  .site-logo {
    font-size: 1.4rem;
    margin-bottom: 5px;
  }

  .logo p {
    display: -webkit-box;
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .mobile-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
    order: 2;
    margin-top: 8px;
  }

  /* 菜单按钮尺寸与圆形按钮一致，内部横线垂直居中 */
  .mobile-menu-toggle {
    width: 34px;
    height: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
  }

  .mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
  }

  .social-icons a {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .main-content {
    padding: 20px;
  }

  footer {
    padding: 12px 20px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .floating-action-buttons {
    right: 15px;
    bottom: 15px;
    gap: 12px;
  }

  .floating-action-buttons .fab {
    width: 50px;
    height: 50px;
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .site-logo { font-size: 1.3rem; }
  .floating-action-buttons .fab { width: 45px; height: 45px; }
}
