/* Dashboard Analytics styles */

/* Grids */
.dash-kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
.dash-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.dash-grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 20px; }
.dash-grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }

/* KPI */
.dash-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; text-align: center; }
.kpi-label { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.kpi-value { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; color: var(--text); }
.kpi-trend { font-family: 'JetBrains Mono', monospace; font-size: 11px; display: block; margin-top: 4px; color: var(--muted); }
.kpi-up { color: #4caf50 !important; }
.kpi-down { color: #f44336 !important; }
.kpi-explain { font-size: 10px; color: var(--muted); margin-top: 6px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.kpi-info { cursor: help; font-style: normal; opacity: 0.6; font-size: 12px; }

/* AI Banner */
.dash-ai-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(131,56,236,0.12), rgba(43,127,255,0.12));
  border: 1px solid rgba(131,56,236,0.25); border-radius: 10px; font-size: 13px; color: var(--text); }
.dash-ai-badge { background: #8338ec; color: #fff; font-size: 9px; font-weight: 800; padding: 2px 7px;
  border-radius: 4px; letter-spacing: 0.5px; flex-shrink: 0; }

/* Migration banner */
.dash-migration-banner { padding: 10px 14px; margin-bottom: 16px; background: rgba(43,127,255,0.08);
  border: 1px solid rgba(43,127,255,0.2); border-radius: 8px; font-size: 12px; color: var(--accent); }

/* Header buttons */
.dash-header-btn { font-size: 11px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text); cursor: pointer; font-family: inherit; transition: all .15s; }
.dash-header-btn:hover { border-color: var(--accent); color: var(--accent); }
.dash-header-accent { border-color: var(--accent); background: rgba(43,127,255,0.1); color: var(--accent); }

/* Action buttons (empty state) */
.dash-action-btn { padding: 10px 20px; border-radius: 8px; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--text); cursor: pointer; font-family: inherit; font-size: 13px; }
.dash-action-primary { border-color: var(--accent); background: rgba(43,127,255,0.1); color: var(--accent); font-weight: 600; }

/* Multi-platform checkboxes */
.dash-plat-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 13px; color: var(--text); font-family: inherit; user-select: none; }
.dash-plat-check input { display: none; }
.dash-plat-check-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border2);
  background: var(--surface2); display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0; }
.dash-plat-check-box::after { content: '\2713'; font-size: 11px; font-weight: 700;
  color: transparent; transition: color .15s; }
.dash-plat-check input:checked + .dash-plat-check-box { background: var(--accent);
  border-color: var(--accent); }
.dash-plat-check input:checked + .dash-plat-check-box::after { color: #FFFFFF; }

/* Heatmap */
.dash-heatmap-grid { display: grid; grid-template-columns: 40px repeat(9, 1fr); gap: 2px; font-size: 10px; }
.hm-corner { }
.hm-hour { text-align: center; color: var(--muted); font-size: 9px; padding: 2px 0; }
.hm-day { display: flex; align-items: center; color: var(--muted); font-size: 10px; font-weight: 600; }
.hm-cell { border-radius: 3px; height: 22px; cursor: default; transition: transform .1s; }
.hm-cell:hover { transform: scale(1.15); z-index: 1; }

/* Type cards */
.dash-type-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; }
.dash-type-icon { font-size: 20px; }

/* Posts table */
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th { text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.dash-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--muted2); }
.dash-table tr:hover td { background: var(--surface2); }
.dash-caption { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-eng { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--accent); }
.dash-cf-badge { display: inline-block; background: rgba(43,127,255,0.15); color: var(--accent);
  font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }

/* Filter buttons */
.dash-filter-btn { font-size: 10px; padding: 4px 10px; border-radius: 5px; border: 1px solid var(--border2);
  background: transparent; color: var(--muted2); cursor: pointer; font-family: inherit; transition: all .15s; }
.dash-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.dash-filter-btn.active { background: rgba(43,127,255,0.1); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Tags & slots */
.dash-tag { display: inline-block; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 3px 10px; font-size: 11px; color: var(--accent); }
.dash-tag small { color: var(--muted); font-size: 10px; }
.dash-slot { display: inline-block; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 6px; padding: 4px 10px; font-size: 11px; color: var(--text); font-weight: 600; }
.dash-slot small { color: var(--muted); font-weight: 400; }

/* AI insights */
.dash-insights { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.dash-insight { font-size: 13px; color: var(--text); padding: 8px 12px; background: var(--surface2);
  border-radius: 6px; border-left: 3px solid var(--accent); }

/* Snapshots */
.dash-snap-row { display: flex; align-items: center; gap: 16px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted2); }
.dash-snap-date { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); min-width: 80px; }
.dash-snap-src { font-size: 11px; min-width: 90px; }
.dash-snap-credits { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); }

.dash-chart-empty { position: absolute; inset: 0; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }

/* Platform selector cards (empty state) */
.dash-plat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 560px; width: 100%; }
.dash-plat-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 12px;
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all .2s; }
.dash-plat-card:hover { border-color: var(--plat-color, var(--accent)); transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15,23,42,0.08); }
.dash-plat-card--active { border-color: var(--plat-color, var(--accent));
  background: color-mix(in srgb, var(--plat-color, var(--accent)) 8%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--plat-color, var(--accent)) 20%, transparent); }
.dash-plat-label { font-size: 12px; font-weight: 600; color: var(--text); text-align: center; }

/* Platform tabs (content header) */
.dash-plat-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.dash-plat-tab { font-size: 12px; padding: 8px 14px; border: none; border-bottom: 2px solid transparent;
  background: none; color: var(--muted); cursor: pointer; font-family: inherit; font-weight: 500;
  display: flex; align-items: center; gap: 6px; transition: all .15s; }
.dash-plat-tab:hover:not(:disabled) { color: var(--text); }
.dash-plat-tab--active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.dash-plat-tab--disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive tablette ── */
@media (max-width: 768px) {
  .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-2-1, .dash-grid-1-2, .dash-grid-1-1 { grid-template-columns: 1fr; }
  .dash-plat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-plat-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dash-plat-tab { padding:10px 16px; font-size:13px; min-height:44px; white-space:nowrap; }
  .dash-header-btn { padding:8px 14px; font-size:12px; min-height:40px; }
  .dash-action-btn { padding:12px 20px; font-size:14px; min-height:48px; }
  .dash-filter-btn { padding:6px 12px; font-size:11px; min-height:36px; }
  .dash-table th { font-size:9px; padding:6px 8px; }
  .dash-table td { padding:6px 8px; font-size:11px; }
  .dash-caption { max-width:160px; }
  .dash-card { padding:14px; }
  .dash-heatmap-grid { font-size:8px; }
  .hm-cell { height:18px; }
  .dash-snap-row { flex-wrap:wrap; gap:8px; }
}

/* ── Responsive mobile ── */
@media (max-width: 480px) {
  #dashContent { padding:12px 8px !important; }
  .dash-header { gap:8px !important; }
  .dash-header h2 { font-size:16px !important; }
  .dash-header-actions { margin-left:0 !important; width:100%; }
  .dash-header-actions .dash-header-btn { flex:1; text-align:center; }
  .dash-empty-btns { flex-direction:column; }
  .dash-empty-btns .dash-action-btn { width:100%; }
  .dash-kpi-grid { grid-template-columns: 1fr 1fr; gap:8px; margin-bottom:16px; }
  .dash-kpi { padding:12px 10px; }
  .kpi-value { font-size:18px; }
  .kpi-label { font-size:9px; letter-spacing:1px; }
  .kpi-explain { font-size:9px; }
  .dash-card { padding:12px; border-radius:8px; }
  .dash-grid-2-1, .dash-grid-1-2, .dash-grid-1-1 { gap:12px; margin-bottom:16px; }
  .dash-plat-grid { grid-template-columns: 1fr 1fr; gap:8px; }
  .dash-plat-card { padding:14px 8px; }
  .dash-plat-label { font-size:11px; }
  .dash-ai-banner { flex-direction:column; align-items:flex-start; font-size:12px; padding:10px 12px; }
  .dash-header-btn { padding:8px 10px; font-size:11px; min-height:40px; }
  .dash-action-btn { width:100%; text-align:center; min-height:48px; }
  .dash-filter-btn { padding:8px 12px; font-size:11px; min-height:40px; }
  .dash-table th { font-size:8px; padding:5px 6px; letter-spacing:0.5px; }
  .dash-table td { padding:5px 6px; font-size:10px; }
  .dash-caption { max-width:100px; }
  .dash-heatmap-grid { grid-template-columns:30px repeat(9,1fr); gap:1px; }
  .hm-cell { height:16px; border-radius:2px; }
  .hm-hour { font-size:7px; }
  .hm-day { font-size:8px; }
  .dash-tag { padding:4px 8px; font-size:10px; }
  .dash-insight { font-size:12px; padding:8px 10px; }
  .dash-snap-row { font-size:11px; gap:6px; padding:6px 0; }
  .dash-snap-date { font-size:10px; min-width:auto; }
  .dash-snap-src { font-size:10px; min-width:auto; }
  .dash-type-card { padding:8px 10px; gap:8px; }
}
