/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0f14;
  --surface:   #161922;
  --border:    #222638;
  --accent:    #7c5cfc;
  --accent2:   #e040fb;
  --green:     #22c55e;
  --red:       #ef4444;
  --text:      #e8eaf0;
  --muted:     #6b7280;
  --font: 'Inter', system-ui, sans-serif;
}

body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; height: 100vh; overflow: hidden; }

/* ── Shell layout ─────────────────────────────────────────────── */
.shell { display: flex; height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.logo {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

nav { padding: 20px 0; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 0 20px 10px;
}

.project-list { display: flex; flex-direction: column; gap: 2px; }

.project-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  border-radius: 0;
  transition: background .15s;
  color: var(--muted);
  font-weight: 500;
  border-left: 3px solid transparent;
}
.project-item:hover  { background: rgba(124,92,252,.08); color: var(--text); }
.project-item.active { background: rgba(124,92,252,.12); color: var(--text); border-left-color: var(--accent); }

.project-badge {
  margin-left: auto;
  font-size: 11px;
  background: rgba(255,255,255,.07);
  border-radius: 10px;
  padding: 1px 7px;
  color: var(--muted);
}
.project-badge.has-errors { background: rgba(239,68,68,.18); color: var(--red); }

.skeleton-item {
  height: 36px;
  margin: 2px 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, rgba(255,255,255,.04) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Main ─────────────────────────────────────────────────────── */
.main { flex: 1; overflow-y: auto; padding: 32px 36px; }

.view { display: none; }
.view.active { display: block; }

/* ── Project header ───────────────────────────────────────────── */
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.project-header h1 { font-size: 22px; font-weight: 700; }

/* ── Dashboard grid ───────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.left-col, .right-col { display: flex; flex-direction: column; gap: 20px; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-weight: 600; font-size: 13px; letter-spacing: .2px; }

/* ── Chart ────────────────────────────────────────────────────── */
.chart-wrap { padding: 20px; position: relative; height: 220px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px;
}

/* ── Stats row ────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
}

.stat-value { font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-sub   { font-size: 10px; color: var(--muted); margin-top: 4px; opacity: .6; }

.error-card  { border-color: rgba(239,68,68,.3); }
.error-card .stat-value { color: var(--red); }
.muted-card .stat-value { color: var(--muted); }

/* ── Error panel ──────────────────────────────────────────────── */
.error-panel { }
.error-title { color: var(--red); }

.error-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.error-row:last-child { border-bottom: none; }
.error-username { font-weight: 600; font-size: 13px; }
.error-msg { font-size: 12px; color: var(--muted); margin-top: 2px; }
.error-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; margin-top: 4px; }

/* ── Activity feed ────────────────────────────────────────────── */
.feed-card { height: calc(100vh - 120px); display: flex; flex-direction: column; }
.feed-card .card-head { flex-shrink: 0; }
.feed { flex: 1; overflow-y: auto; padding: 8px 0; }

.feed-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.feed-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.feed-icon.success { background: rgba(34,197,94,.15); }
.feed-icon.error   { background: rgba(239,68,68,.15); }

.feed-body { flex: 1; min-width: 0; }
.feed-account { font-weight: 600; font-size: 13px; }
.feed-detail  { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time    { font-size: 11px; color: var(--muted); flex-shrink: 0; margin-top: 2px; }

.feed-empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ── Pulse dot ────────────────────────────────────────────────── */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--green);
  opacity: .3;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .3; } 50% { transform: scale(1.6); opacity: 0; } }

/* ── Utilities ────────────────────────────────────────────────── */
.muted  { color: var(--muted); }
.small  { font-size: 12px; }
.hidden { display: none !important; }

/* ── Alert banner ─────────────────────────────────────────────── */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
}
.alert-warning  { background: rgba(234,179,8,.1);  border-color: rgba(234,179,8,.3);  color: #fbbf24; }
.alert-critical { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4);  color: var(--red); }
.alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-msg  { flex: 1; }
.alert-action {
  flex-shrink: 0;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid currentColor;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  opacity: .9;
}
.alert-action:hover { opacity: 1; }

/* ── Posts today stat ─────────────────────────────────────────── */
.posts-card .stat-value { color: var(--accent); }

/* ── Upload card ──────────────────────────────────────────────── */
.upload-bucket-link a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}
.upload-bucket-link a:hover { color: var(--accent); }

.upload-body { padding: 16px 20px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124,92,252,.06);
}

.drop-icon { font-size: 28px; margin-bottom: 8px; }
.drop-text { font-size: 13px; color: var(--text); }
.drop-sub  { font-size: 11px; color: var(--muted); margin-top: 4px; }

.file-label {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.upload-selected { display: flex; flex-direction: column; gap: 12px; }

.selected-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.04);
  border-radius: 8px;
  padding: 10px 14px;
}
.selected-icon { font-size: 20px; flex-shrink: 0; }
.selected-name { font-size: 13px; font-weight: 600; word-break: break-all; }
.selected-size { font-size: 11px; color: var(--muted); margin-top: 2px; }

.clear-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.clear-btn:hover { color: var(--red); }

.upload-btn {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.upload-btn:hover { opacity: .85; }

.upload-progress { display: flex; flex-direction: column; gap: 8px; }
.progress-label  { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .2s;
}

.upload-result {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.upload-result.success { background: rgba(34,197,94,.12); color: var(--green); }
.upload-result.error   { background: rgba(239,68,68,.12);  color: var(--red);   }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
