/* ================================================
   SEO Dashboard — 單一區域大容器（與數據儀表板統一）
   ================================================
   整個 dashboard 包在一個 bg-card 大容器內，
   內部 section 完全透明、無 border、無分隔線
   僅靠 margin 和 h3 做視覺區分
   ================================================ */

#page-admin-seo {
  background: var(--bg-main);
}

/* ★ 關鍵：單一大容器 bg-card，整個 dashboard 放入同一區域 */
#page-admin-seo #seo-dashboard-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  margin: .5rem;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

/* Header 重新整理按鈕：參考活動詳情頁 .event-detail-refresh-btn（class 已沿用）*/

/* 說明按鈕（? icon） */
.seo-info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent; color: var(--accent);
  font-size: .68rem; font-weight: 700;
  cursor: pointer; padding: 0; line-height: 1;
  margin-left: .35rem; vertical-align: middle;
  flex-shrink: 0;
  transition: all .15s;
}
.seo-info-btn:hover { background: var(--accent); color: #fff; }

.seo-loading, .seo-empty {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}
.seo-empty h3 { margin-bottom: .8rem; color: var(--text-primary); }

/* Meta bar — 頂部資訊列，上下排列（不同行） */
.seo-meta-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  padding: .4rem 0;
  background: transparent;
  margin-bottom: 1rem;
  font-size: .8rem;
  color: var(--text-muted);
  border-bottom: 0;
  position: relative;
}
.seo-meta-bar > span {
  display: block;
  line-height: 1.5;
}
.seo-meta-bar strong { color: var(--accent); font-weight: 600; }
/* Meta bar 的說明按鈕定位到右上角 */
.seo-meta-bar > .seo-info-btn {
  position: absolute;
  top: .2rem;
  right: 0;
  margin-left: 0;
}

/* Section — 完全透明、無 border、無分隔線，只用 margin 分隔 */
.seo-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0 0 1.5rem 0;
}
.seo-section:last-child { margin-bottom: 0; }
.seo-section > h3 {
  font-size: .95rem;
  color: var(--accent);
  margin: 0 0 .6rem 0;
  padding: 0;
  border: none;
  display: flex;
  align-items: center;
  gap: .3rem;
  font-weight: 700;
}

.seo-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem 0;
}
.seo-grid-2 .seo-section { margin-bottom: 0; }

/* Overview cards — 小卡片組（用 bg-elevated 區分於主容器 bg-card） */
.seo-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .5rem;
}
.seo-overview-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 10px);
  padding: .75rem .85rem;
}
.seo-overview-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .4rem;
  font-weight: 600;
}
.seo-overview-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
}
.seo-overview-metrics > div {
  display: flex;
  flex-direction: column;
  font-size: .68rem;
  color: var(--text-muted);
}
.seo-overview-metrics strong {
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 700;
  margin-top: .1rem;
  font-family: var(--font-display, inherit);
}

/* Bar chart */
.seo-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 130px;
  padding: 0 .2rem .2rem;
  overflow-x: auto;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 10px);
  padding-top: .3rem;
}
.seo-bar-col {
  flex: 0 0 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}
.seo-bar {
  width: 16px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  transition: opacity .15s;
}
.seo-bar:hover { opacity: .85; }
.seo-bar-click {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .6rem;
  font-weight: 700;
  color: var(--accent);
}
.seo-bar-label {
  font-size: .58rem;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
}

/* Tables — 行底細線為唯一分隔 */
.seo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.seo-table th, .seo-table td {
  padding: .5rem .55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.seo-table th {
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.seo-table tr:last-child td { border-bottom: none; }
.seo-table td { color: var(--text-primary); }
.seo-url-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
}

/* Sitemap items */
.seo-sitemap-item {
  padding: .7rem .8rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 10px);
  margin-bottom: .4rem;
}
.seo-sitemap-item:last-child { margin-bottom: 0; }
.seo-sitemap-path {
  font-family: var(--font-mono, monospace);
  font-size: .78rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: .3rem;
  word-break: break-all;
}
.seo-sitemap-info, .seo-sitemap-contents {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  font-size: .72rem;
  color: var(--text-muted);
}
.seo-sitemap-contents { margin-top: .3rem; }

.seo-empty-note {
  padding: .8rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: .82rem;
}

.seo-footer-note {
  padding: .8rem 0 0 0;
  margin-top: .5rem;
  font-size: .75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.seo-footer-note p { margin: .2rem 0; }

/* 說明彈窗（獨立複製，不依賴 education.css） */
.edu-info-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.edu-info-dialog {
  background: var(--bg-card); border-radius: 16px; padding: 1.2rem 1.4rem;
  max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,.15);
  max-height: calc(100vh - 2rem); display: flex; flex-direction: column;
}
.edu-info-dialog-title {
  font-size: 1rem; font-weight: 700; margin-bottom: .6rem; text-align: center;
  flex-shrink: 0; color: var(--text-primary);
}
.edu-info-dialog-body {
  font-size: .84rem; line-height: 1.65; color: var(--text-secondary);
  overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0;
}
.edu-info-dialog-body ul, .edu-info-dialog-body ol { padding-left: 1.2rem; margin: .4rem 0; }
.edu-info-dialog-body li { margin-bottom: .3rem; }
.edu-info-dialog-body b { color: var(--text-primary); }
.edu-info-dialog-body p { margin: .3rem 0; }

@media (max-width: 640px) {
  #page-admin-seo #seo-dashboard-content { margin: .3rem; padding: .7rem; }
  .seo-overview-metrics strong { font-size: .95rem; }
  .seo-bar-col { flex: 0 0 18px; }
  .seo-bar { width: 14px; }
  .seo-table { font-size: .75rem; }
  .seo-table th, .seo-table td { padding: .4rem .4rem; }
  .seo-url-cell { max-width: 140px; }
  .seo-meta-bar { gap: .6rem; font-size: .75rem; }
  .seo-section { margin-bottom: 1.2rem; }
}
