/* Mega Menu 样式 */
:root {
  --mm-primary: #0ea5e9;
  --mm-primary-dark: #0284c7;
  --mm-bg: #ffffff;
  --mm-text: #1e293b;
  --mm-text-light: #64748b;
  --mm-border: #e2e8f0;
  --mm-hover: #f8fafc;
  --mm-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* 导航容器 */
.mega-menu-nav {
  position: fixed;
  top: 44px; /* 默认在公告栏下面 */
  left: 0;
  right: 0;
  z-index: 9998;
  background: var(--mm-bg);
  border-bottom: 1px solid var(--mm-border);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.mega-menu-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* Logo */
.mega-menu-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.mega-menu-logo img {
  height: 42px;
  width: auto;
}

.mega-menu-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.mega-menu-logo-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e3a5f;
}

.mega-menu-logo-subtitle {
  font-size: 11px;
  color: #5ba4d9;
  letter-spacing: 0.5px;
}

/* 主菜单 */
.mega-menu-items {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.mega-menu-item {
  position: relative;
}

.mega-menu-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--mm-text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mega-menu-link:hover {
  background: var(--mm-hover);
  color: var(--mm-primary);
}

.mega-menu-link.highlight {
  color: #f97316;
}

.mega-menu-link.highlight:hover {
  background: #fff7ed;
}

.mega-menu-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mega-menu-chevron {
  width: 16px !important;
  height: 16px !important;
  transition: transform 0.3s ease;
}

.mega-menu-item:hover .mega-menu-chevron {
  transform: rotate(180deg);
}

/* 下拉面板 */
.mega-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-top: 12px;
  pointer-events: none;
}

.mega-menu-item:hover .mega-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.mega-menu-panel {
  background: var(--mm-bg);
  border-radius: 16px;
  box-shadow: var(--mm-shadow);
  border: 1px solid var(--mm-border);
  overflow: hidden;
  min-width: 320px;
}

/* 大面板（带图片） */
.mega-menu-panel.large {
  min-width: 700px;
  display: grid;
  grid-template-columns: 1fr 280px;
}

.mega-menu-panel-content {
  padding: 20px;
}

.mega-menu-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--mm-text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  padding: 0 12px;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.mega-menu-grid.single-col {
  grid-template-columns: 1fr;
}

.mega-menu-subitem {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.mega-menu-subitem:hover {
  background: var(--mm-hover);
}

.mega-menu-subitem-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mega-menu-subitem-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

/* 线性简约图标风格 - 统一黑框 */
.mega-menu-subitem-icon {
  background: #ffffff !important;
  border: 1.5px solid #1e293b !important;
}
.mega-menu-subitem-icon svg {
  color: #1e293b !important;
}

.mega-menu-subitem-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-menu-subitem-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--mm-text);
}

.mega-menu-subitem-desc {
  font-size: 12px;
  color: var(--mm-text-light);
  line-height: 1.4;
}

/* 面板图片区 */
.mega-menu-panel-image {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 280px;
}

.mega-menu-panel-img {
  width: 180px;
  height: 135px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.mega-menu-panel-image:hover .mega-menu-panel-img {
  transform: scale(1.05);
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}

.mega-menu-panel-image-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mm-text);
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.mega-menu-panel-image-desc {
  font-size: 13px;
  color: var(--mm-text-light);
  line-height: 1.6;
  transition: all 0.2s ease;
  max-width: 200px;
}

/* 悬停时子项高亮 */
.mega-menu-subitem:hover {
  background: var(--mm-hover);
  transform: translateX(4px);
}

.mega-menu-subitem {
  transition: all 0.2s ease;
}

/* 用户区域 */
.mega-menu-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.mega-menu-user-login {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 24px;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mega-menu-user-login:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.mega-menu-user-info {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
}

.mega-menu-user-info:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mega-menu-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mega-menu-user-points {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #ea580c;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #fed7aa;
}

.mega-menu-user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 12px;
  background: var(--mm-bg);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--mm-border);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 10001;
}

.mega-menu-user-info:hover .mega-menu-user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-menu-user-dropdown-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.mega-menu-user-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mega-menu-user-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.mega-menu-user-dropdown-points {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #ea580c;
}

.mega-menu-user-dropdown-points svg {
  width: 14px;
  height: 14px;
}

.mega-menu-user-dropdown-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
  margin: 4px 12px;
}

.mega-menu-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.mega-menu-user-dropdown-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.mega-menu-user-dropdown-item.danger {
  color: #dc2626;
}

.mega-menu-user-dropdown-item.danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.mega-menu-user-dropdown-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.mega-menu-user-dropdown-item:hover svg {
  opacity: 1;
}

/* 联系我们下拉 */
.mega-menu-contact-panel {
  padding: 20px;
  text-align: center;
}

.mega-menu-contact-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--mm-text);
  margin-bottom: 12px;
}

.mega-menu-contact-qr {
  width: 160px;
  height: 160px;
  background: #f1f5f9;
  border-radius: 12px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mega-menu-contact-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mega-menu-contact-wechat {
  font-size: 13px;
  color: var(--mm-text-light);
}

/* 隐藏 React 原生导航 */
#root > nav,
#root > header,
#root > div > nav,
#root > div > header,
#root > div > div:first-child > nav,
[class*="Nav"],
[class*="Header"] {
  /* 不直接隐藏，因为可能会影响弹窗 */
}

/* 为固定导航腾出空间 */
body.has-mega-menu {
  padding-top: 116px; /* 44px公告栏 + 72px导航 */
}

/* 移动端适配 */
@media (max-width: 1024px) {
  .mega-menu-items {
    display: none;
  }
  
  .mega-menu-mobile-toggle {
    display: flex;
  }
}

@media (min-width: 1025px) {
  .mega-menu-mobile-toggle {
    display: none;
  }
}

/* 简单的小型下拉（用于联系我们等） */
.mega-menu-simple-dropdown {
  min-width: 220px;
}

/* React 用户按钮插槽 */
.mega-menu-react-user {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.mega-menu-react-user > * {
  display: flex !important;
}

