@import url('variables.css');

/* 亮色科技风：青蓝霓虹 */
:root {
  --ra-glow: #00d4ff;
  --ra-glow-soft: rgba(0,212,255,.2);
  --cyan: #00d4ff;
  --metal-border: rgba(0,153,230,.25);
  --metal-highlight: rgba(255,255,255,.85);
  --neon-glow: 0 0 20px rgba(0,212,255,.4);
}

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-index-sticky);
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  border-bottom: 1px solid rgba(0,212,255,.35);
  box-shadow: 0 1px 0 var(--metal-highlight) inset, 0 0 20px var(--ra-glow-soft);
}

.header-top {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid rgba(0,153,230,.15);
  font-size: var(--font-size-sm);
  color: #1e293b;
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
}

.header-top-left,
.header-top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-top a {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.header-top a:hover {
  color: var(--primary-color);
}

.header-main {
  background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
  color: #1e293b;
  border-bottom: 1px solid rgba(0,212,255,.25);
  box-shadow: 0 1px 0 var(--metal-highlight) inset;
}

.header-main .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  color: #1e293b;
  text-decoration: none;
  padding: 6px 0;
}

.header-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
  border: 1px solid rgba(0,212,255,.4);
  border-radius: 8px;
  color: var(--cyan);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.5px;
  text-shadow: 0 0 12px var(--ra-glow-soft);
  box-shadow: 0 0 14px var(--ra-glow-soft), inset 0 1px 0 rgba(255,255,255,.6);
}

.header-logo img {
  height: 52px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
}

.header-logo-text {
  display: flex;
  flex-direction: column;
}

.header-logo-text span {
  font-size: 14px;
  font-weight: var(--font-weight-normal);
  opacity: 0.9;
}

.header-search {
  flex: 1;
  max-width: 500px;
  margin: 0 40px;
  display: flex;
  align-items: center;
}

.header-search-form {
  display: flex;
  width: 100%;
  gap: 10px;
}

.header-search-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid rgba(0,153,230,.2);
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-base);
  background: #fff;
  color: #1e293b;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.header-search-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(0,212,255,.25), 0 0 20px var(--ra-glow-soft);
}

.header-search-button {
  padding: 10px 24px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099e6 50%, #0891b2 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: var(--neon-glow), inset 0 1px 0 rgba(255,255,255,.25);
}

.header-search-button:hover {
  box-shadow: 0 0 24px rgba(0,212,255,.5), inset 0 1px 0 rgba(255,255,255,.3);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav-item {
  position: relative;
}

.header-nav-link {
  display: block;
  padding: 8px 16px;
  color: #1e293b;
  font-size: var(--font-size-base);
  text-decoration: none;
  border-radius: var(--border-radius-base);
  transition: var(--transition-fast);
}

.header-nav-link:hover {
  background: rgba(0,212,255,.1);
  color: #0891b2;
  box-shadow: 0 0 14px var(--ra-glow-soft);
}

.header-nav-link.active {
  background: rgba(0,212,255,.15);
  color: #0891b2;
  box-shadow: 0 0 12px var(--ra-glow-soft) inset;
}

.header-dropdown-toggle::after {
  content: '▾';
  margin-left: 4px;
  font-size: 10px;
}

.header-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  padding: 8px 0;
  background-color: var(--background-color-white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-base);
  box-shadow: var(--box-shadow-lg);
  display: none;
  z-index: var(--z-index-dropdown);
}

.header-dropdown:hover .header-dropdown-menu {
  display: block;
}

.header-dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.header-dropdown-item:hover {
  background-color: var(--background-color-light);
  color: var(--primary-color);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--background-color-light);
  border: 2px solid var(--background-color-white);
  cursor: pointer;
  overflow: hidden;
}

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

.header-user-name {
  color: #1e293b;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
}

.header-user-actions {
  display: flex;
  gap: 8px;
}

.header-button {
  padding: 8px 20px;
  background: #fff;
  color: #0099e6;
  border: 1px solid rgba(0,153,230,.3);
  border-radius: var(--border-radius-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: var(--transition-fast);
}

.header-button:hover {
  border-color: var(--cyan);
  box-shadow: var(--neon-glow);
}

.header-button.primary {
  background: linear-gradient(135deg, #00d4ff, #0099e6);
  color: #fff;
  border-color: rgba(255,255,255,.3);
  box-shadow: var(--neon-glow), inset 0 1px 0 rgba(255,255,255,.25);
}

.header-button.primary:hover {
  box-shadow: 0 0 24px rgba(0,212,255,.5), inset 0 1px 0 rgba(255,255,255,.3);
}

.header-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.header-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: #1e293b;
  transition: var(--transition-fast);
}

.header-categories {
  background: #fff;
  border-bottom: 1px solid rgba(0,212,255,.2);
}

.header-categories .container {
  display: flex;
  align-items: center;
  height: 44px;
}

.header-categories-list {
  display: flex;
  list-style: none;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.header-categories-item {
  margin: 0;
}

.header-categories-link {
  display: block;
  padding: 10px 20px;
  color: #1e293b;
  font-size: var(--font-size-base);
  text-decoration: none;
  border-radius: var(--border-radius-base);
  transition: var(--transition-fast);
  border: 1px solid rgba(0,153,230,.2);
  background: #fff;
}

.header-categories-link:hover {
  color: #0891b2;
  border-color: var(--cyan);
  box-shadow: var(--neon-glow);
  transform: translateY(-1px);
}

.header-categories-link.active {
  color: #0891b2;
  font-weight: var(--font-weight-medium);
  border-color: var(--cyan);
  box-shadow: var(--neon-glow), 0 0 12px var(--ra-glow-soft) inset;
}

.header-categories-link .cat-icon {
  opacity: .8;
  margin-right: 4px;
  transition: color .2s;
}
.header-categories-link:hover .cat-icon,
.header-categories-link.active .cat-icon {
  color: var(--cyan);
  opacity: 1;
}

@media (max-width: 992px) {
  .header-nav {
    display: none;
  }
  
  .header-menu-toggle {
    display: flex;
  }
  
  .header-search {
    display: none;
  }
  
  .header-nav-mobile {
    display: block;
  }
}

/* 右上角用户区：登录/注册 或 头像+用户名 */
.header-user-area {
  display: inline-flex;
  align-items: center;
}
.header-user-sep {
  margin: 0 6px;
  color: var(--text-secondary);
}
.auth-trigger {
  cursor: pointer;
  text-decoration: none;
  color: var(--text-secondary);
}
.auth-trigger:hover {
  color: var(--primary-color);
}
.header-user-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-secondary);
}
.header-user-link:hover {
  color: var(--primary-color);
}
.header-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.header-user-avatar-default {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.header-username {
  font-size: var(--font-size-sm);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 登录/注册弹窗 */
.auth-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
}
.auth-modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 24px;
  width: 100%;
  max-width: 360px;
}
.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #666;
  cursor: pointer;
}
.auth-modal-close:hover {
  color: #1e293b;
}
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.auth-tab {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.auth-tab:hover,
.auth-tab.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}
.auth-form input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary-color);
}
.auth-form-msg {
  font-size: 13px;
  color: #dc2626;
  margin-bottom: 8px;
  min-height: 18px;
}
.auth-form button[type="submit"] {
  width: 100%;
  padding: 10px;
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.auth-form button[type="submit"]:hover {
  opacity: .9;
}

@media (max-width: 768px) {
  .header-top {
    display: none;
  }
  
  .header-logo-text {
    display: none;
  }
  
  .header-categories {
    overflow-x: auto;
    white-space: nowrap;
  }
  
  .header-categories-list {
    padding: 0 10px;
  }
}
