/* ============================================================
   core/common.css
   全局公共样式 — CSS Variables + Reset + 通用组件
   ============================================================ */

/* ===== CSS Variables ===== */
:root {
  --primary: #3ecf8e;
  --primary-dark: #2aad72;
  --primary-light: #d2f5e8;
  --bg: #f4f6f9;
  --bg-white: #fff;
  --border: #e2e8f0;
  --text-main: #1a202c;
  --text-sub: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: all 0.2s ease;
  --header-h: 64px;
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}
a {
  text-decoration: none;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}
ul {
  list-style: none;
}
img {
  max-width: 100%;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== 工具类 ===== */
.hidden { display: none !important; }

/* ===== Header ===== */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
}
.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}
.hl { color: var(--primary-dark); }
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 20px;
  flex: 1;
  overflow-x: auto;
}
.header-nav::-webkit-scrollbar { height: 0; }
.nav-item {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-sub);
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  display: inline-block;
}
.nav-item:hover, .nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.lang-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--primary);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-white);
  transition: var(--transition);
  cursor: pointer;
}
.lang-btn:hover { background: var(--primary); color: #fff; }

/* ===== Main Layout ===== */
#main-wrap {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  gap: 20px;
}

/* ===== Sidebar ===== */
#sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-section {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.sidebar-title {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-light);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-sub);
  transition: var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
}
.sidebar-item:hover, .sidebar-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
}
.sidebar-item.active { font-weight: 600; }
.s-ic { font-size: 15px; width: 20px; text-align: center; }
.s-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

/* ===== Content Area ===== */
#content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== Right Panel ===== */
#right-panel {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== Hero Banner ===== */
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #134e3f 60%, #1a6b50 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  position: relative;
}
.hero-banner::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(62, 207, 142, 0.12);
}
.hero-left { position: relative; z-index: 1; }
.hero-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.hero-sub { font-size: 14px; opacity: 0.75; line-height: 1.6; }
.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.hero-badge {
  padding: 4px 12px;
  border-radius: 14px;
  background: rgba(62, 207, 142, 0.2);
  border: 1px solid rgba(62, 207, 142, 0.4);
  font-size: 12px;
  font-weight: 600;
  color: #a7f3d0;
}
.hero-stats {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.stat-item { text-align: center; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; opacity: 0.7; }

/* ===== Section Box ===== */
.section-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
  display: block;
}
.section-desc { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ===== Right Cards ===== */
.r-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.r-card-title {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 6px;
}
.r-card-body { padding: 14px 16px; }

/* ===== Extension Section ===== */
.ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.ext-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.ext-card:hover { border-color: var(--primary); background: var(--primary-light); }
.ec-icon { font-size: 32px; }
.ec-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.ec-desc { font-size: 12px; color: var(--text-light); }
.coming-tag {
  padding: 3px 10px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

/* ===== Right Side Items ===== */
.ext-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ext-item:last-child { border-bottom: none; }
.ext-icon-s { font-size: 20px; width: 28px; text-align: center; }
.ext-name { font-weight: 500; }
.ext-coming {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 10px;
  font-weight: 600;
}

/* ===== AdSense Slot ===== */
#ad-slot {
  width: 100%;
  aspect-ratio: 300 / 250;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px dashed #86efac;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  font-size: 13px;
  gap: 6px;
}
.ad-icon { font-size: 28px; }
.ad-label { font-size: 12px; font-weight: 600; }
.ad-size { font-size: 11px; color: #86efac; font-weight: 700; letter-spacing: 0.04em; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  max-width: 660px;
  width: 100%;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-hd {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { font-size: 22px; color: var(--text-light); line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text-main); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-sub);
}
.modal-body h3 { font-size: 15px; font-weight: 700; color: var(--text-main); margin: 14px 0 6px; }
.modal-body ul { padding-left: 18px; list-style: disc; }
.modal-body li { margin-bottom: 4px; }
.privacy-highlight {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
  font-size: 13px;
  color: var(--primary-dark);
  font-weight: 600;
}

/* ===== Footer ===== */
#footer {
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-light);
}
#footer a { color: var(--text-sub); transition: var(--transition); }
#footer a:hover { color: var(--primary-dark); }
.footer-links { display: flex; gap: 16px; }

/* ===== Toast ===== */
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-main);
  color: #fff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 300;
  transition: transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }
