/* 阿拉丁微信云端官网 - 纯 PHP 站点样式 */
:root {
  --sidebar-bg: #1e1b4b;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(99, 102, 241, 0.25);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  overflow: hidden; /* 框架页本身不滚动，滚动由 iframe 内部子页面处理 */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
/* 在 iframe 内加载的子页面：恢复默认可滚动，滚动交给 iframe 视口 */
body.page-body {
  height: auto;
  overflow: visible;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
}

.logo:hover { opacity: 0.9; }

.logo-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 6px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 6px;
  border-radius: 10px;
  color: #c7cbe0;
  text-decoration: none;
  transition: all 0.2s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.user-avatar-link {
  display: inline-flex;
  cursor: pointer;
}

.user-avatar-link:hover .user-avatar {
  opacity: 0.8;
}

.user-name { font-weight: 600; font-size: 14px; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

/* 主内容 */
.main {
  flex: 1;
  margin-left: 240px;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
}

.topbar-brand {
  display: none; /* 桌面端侧边栏已有品牌，顶部栏隐藏避免重复 */
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #1e1b4b;
  font-weight: 700;
  font-size: 16px;
  transition: opacity 0.2s;
}
.topbar-brand:hover { opacity: 0.8; }

.topbar-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
}

.topbar-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.status-dot.down {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.topbar-status.down { color: #ef4444; }

.topbar-update {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* iframe 容器：只负责定位与撑满，自身不滚动（滚动交给 iframe 内部） */
.iframe-container {
  flex: 1;
  min-height: 0; /* 关键：允许 flex 子项收缩到剩余视口高度，iframe 才能拿到确定高度 */
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.content-iframe {
  position: absolute; /* 关键：用绝对定位撑满容器，避免移动端百分比高度解析不稳定（刷新偶发塌陷） */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; /* 解析对象为 .iframe-container（relative + flex 确定高度），每次都稳定 */
  border: none;
  display: none;
}

.content-iframe.active { display: block; }

/* 子页面 body */
.page-body { background: var(--bg); }
.page-content {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-sm { padding: 6px 12px; }
.btn-primary { background: var(--primary); color: #fff; padding: 12px 20px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }
.btn-block { width: 100%; }

/* 首页品牌区 */
.brand-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 9px;
}

.brand-name {
  font-size: 22px;
  font-weight: 800;
  color: #1e1b4b;
  letter-spacing: 0.5px;
}

/* 代理购买 */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.agent-card {
  background: #fafafe;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.agent-card:hover { box-shadow: var(--shadow-lg); }

.agent-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 14px;
}

.agent-icon.blue { background: #3b82f6; }
.agent-icon.purple { background: #8b5cf6; }

.agent-card h3 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.agent-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 14px; }

.agent-features {
  list-style: none;
  margin-bottom: 18px;
  flex: 1;
}

.agent-features li {
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: 20px;
  position: relative;
  margin-bottom: 8px;
}

.agent-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #10b981;
  font-weight: 700;
}

/* 欢迎卡片 */
.welcome-card {
  background: linear-gradient(90deg, #eef2ff 0%, #fff 100%);
  border: 1px solid #e0e7ff;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.welcome-card h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1e1b4b;
}

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

/* 公告 */
.notice-bar {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #92400e;
}

.notice-tag {
  background: #f59e0b;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* 面板 */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.panel-header h2 { font-size: 18px; font-weight: 700; color: #1e1b4b; }
.panel-sub { font-size: 13px; color: var(--text-secondary); }

/* 功能简介 */
.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.intro-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
}

.intro-card:hover { box-shadow: var(--shadow-lg); }

.intro-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.intro-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.intro-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  margin-bottom: 12px;
}

.intro-icon.blue { background: #3b82f6; }
.intro-icon.purple { background: #8b5cf6; }
.intro-icon.green { background: #10b981; }

/* 价格卡片 */
.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.price-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
  border-top: 4px solid;
}

.price-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.price-card.blue { border-top-color: #3b82f6; }
.price-card.indigo { border-top-color: #6366f1; }
.price-card.purple { border-top-color: #8b5cf6; }
.price-card.pink { border-top-color: #ec4899; }
.price-card.orange { border-top-color: #f59e0b; }
.price-card.green { border-top-color: #10b981; }

.price-top { margin-bottom: 12px; }
.price-name { display: block; font-size: 16px; font-weight: 700; color: var(--text); }
.price-value { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 16px; }

/* 简单内容页 */
.simple-content { font-size: 15px; color: var(--text-secondary); line-height: 1.8; }
.simple-content p { margin-bottom: 12px; }
.simple-content .url-link {
  display: inline-block;
  background: #eef2ff;
  color: var(--primary);
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  word-break: break-all;
  margin-bottom: 12px;
}
.simple-content .url-link:hover { background: #e0e7ff; }
.simple-content .tip { font-size: 13px; color: var(--text-secondary); }
.doc-list { margin-top: 12px; padding-left: 18px; }
.doc-list li { margin-bottom: 8px; }

.footer {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* 响应式 */
@media (max-width: 1024px) {
  .price-grid { grid-template-columns: repeat(2, 1fr); }
  .intro-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .page-content { padding: 16px; }

  .topbar-brand { display: flex; }
  .topbar-status, .topbar-update { display: none; }

  .price-grid { grid-template-columns: repeat(2, 1fr); }
  .agent-grid { grid-template-columns: 1fr; }
  .intro-grid { grid-template-columns: 1fr; }

  .panel-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .price-grid { grid-template-columns: 1fr; }
}
