/* ============================================
   header.css - 椤堕儴瀵艰埅鏍忔牱寮?   showapi.com 1:1 澶嶅埢
   ============================================ */

/* 瀵艰埅鏍忓鍣?*/
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: #fff;
  transition: box-shadow 0.3s;
}

.site-header.scrolled {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 导航栏内容 */
.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
  padding: 0 var(--gap-md);
}

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 40px;
  flex-shrink: 0;
  min-width: 200px;
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
}

.header-logo .logo-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

/* 瀵艰埅鑿滃崟 */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.header-nav .nav-item {
  padding: 8px 16px;
  font-size: 16px;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  white-space: nowrap;
}

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

/* 鍙充晶鎿嶄綔鍖?*/
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ========== 用户头像hover下拉菜单 ========== */
.user-hover-wrap {
  position: relative;
}

.user-info-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #222;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.user-info-link:hover {
  background: #f5f6f8;
}

.user-avatar-small {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.user-name-text {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

/* 下拉菜单 */
.user-hover-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  border: 1px solid #f0f0f0;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s ease;
  z-index: 1100;
  margin-top: 4px;
}

.user-hover-wrap:hover .user-hover-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}

.dropdown-user-info { flex: 1; min-width: 0; }
.dropdown-username {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown-email {
  font-size: 12px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.dropdown-balance {
  padding: 8px 16px;
  font-size: 13px;
  color: #4f6ef7;
  font-weight: 600;
  background: #f8fafc;
  margin: 0 8px;
  border-radius: 6px;
}

.dropdown-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 4px 12px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #444;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: #f5f6f8;
  color: #222;
}

.dropdown-item svg {
  color: #999;
  flex-shrink: 0;
}

.dropdown-item:hover svg {
  color: #4f6ef7;
}

.dropdown-logout {
  color: #e53e3e;
}

.dropdown-logout:hover {
  color: #e53e3e;
  background: #fff5f5;
}

.dropdown-logout svg {
  color: #e53e3e;
}

.dropdown-logout:hover svg {
  color: #e53e3e;
}

/* 鎼滅储妗?*/
.header-search {
  position: relative;
  width: 200px;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-page);
  transition: all 0.2s;
}

.header-search input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
}

/* 鐧诲綍/娉ㄥ唽鎸夐挳 */
.header-actions .btn-login {
  padding: 6px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.header-actions .btn-login:hover {
  color: var(--primary);
}

/* 姹夊牎鑿滃崟鎸夐挳锛堢Щ鍔ㄧ锛?*/
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.3s;
}

/* 绉诲姩绔晶杈硅彍鍗?*/
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 999;
  padding: 16px;
  overflow-y: auto;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu .mobile-nav-item {
  display: block;
  padding: 14px 0;
  font-size: 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.mobile-menu .mobile-nav-item.active {
  color: var(--primary);
}

/* 汉堡按钮激活态 - X形 */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* 移动端适配 */

@media (max-width: 768px) {
  .site-header { height: 50px; }
  :root { --header-height: 50px; }
  .header-inner { padding: 0 12px; }
  .header-logo { margin-right: 16px; }
  .header-logo .logo-text { font-size: 16px; }
  .header-nav { display: none; }
  .header-search { display: none; }
  .hamburger { display: flex; }
  .header-actions .btn-login { display: inline-block; padding: 6px 16px !important; }
  .header-actions .btn-primary { padding: 6px 16px !important; }
  .mobile-menu { display: none; }
  .mobile-menu.active { display: block; }
}
