/* ===================================
   头部和底部样式 - 现代化设计
   =================================== */

/* 头部样式 */
.site-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  transition: all 0.3s;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.logo {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 12px;
  transition: transform 0.3s;
}

.logo a:hover {
  transform: scale(1.02);
}

.logo-circle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #2A5DAA 0%, #4B8CD7 100%);
  box-shadow: 0 4px 12px rgba(42, 93, 170, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.logo a:hover .logo-circle {
  box-shadow: 0 6px 16px rgba(42, 93, 170, 0.35);
  transform: rotate(-5deg);
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.logo span {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #2A5DAA 0%, #4B8CD7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.main-nav {
  flex: 1;
  margin: 0;
}

.nav-list {
  display: flex;
  justify-content: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: inline-block;
  color: #475569;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  position: relative;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
  color: #2A5DAA;
  background: rgba(42, 93, 170, 0.08);
}

.nav-link.active {
  color: white;
  background: linear-gradient(135deg, #2A5DAA 0%, #4B8CD7 100%);
  box-shadow: 0 4px 12px rgba(42, 93, 170, 0.3);
}

.nav-link.active:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(42, 93, 170, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 220px;
  height: 40px;
  padding: 0 40px 0 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  background: #f8fafc;
  color: #1e293b;
  transition: all 0.3s;
}

.search-box input:focus {
  border-color: #2A5DAA;
  background: white;
  outline: none;
  box-shadow: 0 0 0 3px rgba(42, 93, 170, 0.1);
}

.search-box input::placeholder {
  color: #94a3b8;
}

.search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  transition: color 0.3s;
}

.search-btn:hover {
  color: #2A5DAA;
}

.user-menu {
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

.user-avatar {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  z-index: 1;
  border: 2px solid transparent;
}

.user-avatar:hover {
  transform: scale(1.05);
  border-color: #2A5DAA;
  box-shadow: 0 4px 12px rgba(42, 93, 170, 0.3);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
  pointer-events: none;
}

.user-menu:hover .dropdown-menu,
.user-menu:focus-within .dropdown-menu,
.dropdown-menu:focus-within {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: #475569;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 8px;
  font-weight: 500;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: linear-gradient(135deg, rgba(42, 93, 170, 0.1) 0%, rgba(75, 140, 215, 0.1) 100%);
  color: #2A5DAA;
  outline: none;
  transform: translateX(4px);
}

.dropdown-item:active {
  background: linear-gradient(135deg, rgba(42, 93, 170, 0.15) 0%, rgba(75, 140, 215, 0.15) 100%);
}

/* 登录注册按钮 */
.auth-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
}

.login-btn {
  color: #2A5DAA;
  background: rgba(42, 93, 170, 0.1);
}

.login-btn:hover {
  background: rgba(42, 93, 170, 0.15);
  transform: translateY(-1px);
}

.register-btn {
  color: white;
  background: linear-gradient(135deg, #2A5DAA 0%, #4B8CD7 100%);
  box-shadow: 0 4px 12px rgba(42, 93, 170, 0.3);
}

.register-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(42, 93, 170, 0.4);
}

/* 移动设备优化 */
@media (hover: none) {
  .user-menu {
    outline: none;
  }

  .dropdown-menu {
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .user-menu:focus .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* 底部样式 */
.site-footer {
  background-color: #F5F8FC;
  padding: 48px 0 24px;
  margin-top: 48px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 简化页脚样式 */
.footer-simple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.footer-simple .footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.footer-simple .footer-logo img {
  height: 32px;
}

.footer-simple .footer-logo span {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.footer-simple .footer-nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.footer-simple .footer-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.3s;
  white-space: nowrap;
}

.footer-simple .footer-nav a:hover {
  color: var(--primary-color);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: 32px;
}

.footer-logo {
  flex-shrink: 0;
}

.footer-logo img {
  height: 48px;
  margin-bottom: 16px;
}

.footer-logo p {
  color: var(--text-secondary);
  font-size: 14px;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  flex: 1;
}

.link-group h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.link-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-group li {
  margin-bottom: 12px;
}

.link-group a {
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.3s;
  /* 避免中文或长链接在小屏溢出 */
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 桌面端优化：每组链接两行封顶，向右扩列 */
@media screen and (min-width: 993px) {
  .link-group ul {
    display: grid;
    grid-auto-flow: column;              /* 按列填充 */
    grid-template-rows: repeat(1, auto); /* 每列最多一行 */
    grid-auto-columns: max-content;   /* 列宽自适应内容 */
    column-gap: 28px;
    row-gap: 0;
  }

  .link-group li {
    margin-bottom: 0; /* 交给 row-gap 控制 */
  }
}

.link-group a:hover {
  color: var(--primary-color);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid #EEEEEE;
  text-align: center;
}

.footer-simple + .footer-bottom {
  margin-top: 24px;
}

.copyright {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 响应式调整 */
@media screen and (max-width: 992px) {
  .footer-top {
    flex-direction: column;
    gap: 32px;
  }

  .footer-logo {
    text-align: center;
  }

  .footer-links {
    /* 使用自适应列数，避免换行错乱 */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 32px;
    align-items: start;
  }
}

@media screen and (max-width: 768px) {
  .site-footer {
    padding: 32px 0 16px;
  }

  .footer-container {
    padding: 0 16px;
  }

  .footer-links {
    /* 更紧凑的两列布局 */
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 24px;
    text-align: left;
  }

  .footer-top {
    align-items: center;
  }

  .link-group a {
    display: inline-block;
    padding: 6px 0; /* 放大触控热区 */
  }

  /* 移动端：每组链接一行封顶，向右扩列，减少高度 */
  .link-group ul {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(1, auto);
    grid-auto-columns: max-content;
    column-gap: 16px;
    row-gap: 0;
    justify-content: start;
  }

  /* ——— 顶部搜索框移动端优化 ——— */
  .header-actions {
    width: 100%;
    align-items: center;
    gap: 12px;              /* 减小间距，避免按钮被挤开 */
    justify-content: flex-start;
  }

  .search-box {
    flex: 1;                 /* 占满可用空间 */
    min-width: 0;            /* 防溢出 */
    position: relative;      /* 作为按钮定位基准 */
  }

  .search-box input {
    width: 100%;             /* 不再固定 180px */
    padding-right: 40px;     /* 为按钮预留空间 */
    height: 36px;
  }

  .search-btn {
    right: 12px;             /* 与输入框内边距对应 */
    top: 50%;
    transform: translateY(-50%);
  }
}

@media screen and (max-width: 480px) {
  .footer-links {
    /* 极小屏也保持双列，更紧凑 */
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 16px 20px;
    text-align: left;
  }

  /* 去除分割线，避免列间断裂感 */
  .link-group {
    padding-bottom: 0;
    border-bottom: none;
  }

  .footer-container {
    padding: 0 12px; /* 极小屏再收紧一点边距 */
  }

  .footer-logo img {
    height: 40px; /* 极小屏略微缩小 logo */
  }

  /* 极小屏：保持一行封顶，列间距略小 */
  .link-group ul {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(1, auto);
    grid-auto-columns: max-content;
    column-gap: 12px;
    row-gap: 0;
    justify-content: start;
  }
}

@media screen and (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .main-nav {
    width: 100%;
    margin: 0;
  }
  
  .nav-list {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .search-box input {
    width: 180px;
  }
}
