/* ================== 全局通用样式 ================== */
/* 防止滚动条显隐导致页面抖动（最关键） */
html {
  scrollbar-gutter: stable;
  overflow-x: hidden;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
:root {
  --primary: #0ea5e9;
  --primary-light: rgba(45, 125, 255, 0.1);
  --primary-hover: #1889f4;
  --text: #111827;
  --text-secondary: #6B7280;
  --text-nav: #393939;
  --bg: #fff;
  --bg-light: #f9fafb;
  --border: #e5e7eb;
  --radius: 12px;
  --transition: all 0.26s ease;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.03);
}
body {
  background: var(--bg-light);
  color: var(--text);
  line-height: 1.5;
}
li {
  list-style: none !important;
}
a {
  text-decoration: none !important;
}

/* ================== 头部公共样式 ================== */
.header {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.nav {
  width: 100%;
  padding: 0 40px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

/* —— Logo 与天气 —— */
.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.logo-img {
  height: 28px;
  width: auto;
  display: block;
}
.weather-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: 16px;
  border-left: 1px solid #E2E8F0;
  white-space: nowrap;
  max-width: 550px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sailing-advice {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}
.advice-danger { color: #dc2626; background: rgba(254, 242, 242, 0.9); }
.advice-warning { color: #d97706; background: rgba(254, 249, 232, 0.9); }
.advice-safe { color: #059669; background: rgba(236, 253, 245, 0.9); }
.update-time {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

/* —— 导航与操作区 —— */
.nav-group {
  display: flex;
  align-items: center;
  gap: 24px;
}
.nav-menu {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all .3s ease;
  position: relative;
  padding: 8px 0;
}
.nav-menu a:hover {
  color: var(--primary);
}
.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary);
  transition: all .3s ease;
  border-radius: 2px;
}
.nav-menu a:hover::after {
  width: 24px;
}

/* 购物车图标 */
.action-icon {
  font-size: 22px !important;
  color: #333 !important;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  display: inline-block;
}
.action-icon:hover {
  color: var(--primary) !important;
  transform: scale(1.18) rotate(2deg);
}

/* —— 用户信息区域（重点修复部分）—— */
.user-info {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default; /* 关键：避免整个容器显示手型 */
}

/* 可点击的用户展示区域 */
.user-display {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}
.user-display:hover {
  background-color: rgba(14, 165, 233, 0.08);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}
.user-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.user-display:hover .user-name {
  color: var(--primary);
}

/* 下拉菜单 */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 130px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.25s ease;
  z-index: 999;
}
.user-info:hover .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
}
.drop-item:hover {
  background: #f5f7fa;
  color: var(--primary);
}

/* —— 侧边栏选中高亮（保留）—— */
.nav-item.active {
  color: var(--primary) !important;
  background-color: #f0f7ff !important;
  font-weight: 500 !important;
}
/* ================== 搜索框通用样式（新增） ================== */
/* 全局搜索输入框基础样式，避免输入时背景丢失 */
.search-input {
  background-color: transparent; /* 继承父容器背景 */
  background: var(--bg); /* 兜底背景色 */
  outline: none;
  border: none;
  font-size: inherit;
  color: var(--text);
}
/* 聚焦/输入状态下强制保留背景 */
.search-input:focus,
.search-input:not(:placeholder-shown) {
  background-color: var(--bg) !important;
  box-shadow: none !important; /* 清除浏览器默认聚焦阴影 */
}
/* 占位符样式统一 */
.search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.8;
}