/* calendar.css — CreatorPilot content calendar dashboard */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0b0f;
  --bg-surface: #13151a;
  --bg-elevated: #1c1f27;
  --bg-hover: #22262f;
  --border: #2a2d38;
  --border-subtle: #1e2129;
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.06);
  --text: #e8e6e1;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --yellow: #facc15;
  --yellow-dim: rgba(250, 204, 21, 0.12);
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.4);
  --transition: 0.18s ease;
  /* Aliases used by competitor tracker */
  --surface-1: var(--bg);
  --surface-2: var(--bg-surface);
  --surface-3: var(--bg-elevated);
  --text-primary: var(--text);
  --text-secondary: var(--text-dim);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── TOP NAV ─────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 56px;
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-logo span { color: var(--accent); }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ─── PAGE LAYOUT ──────────────────────────────── */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}

/* ─── HEADER / TITLE ───────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.2;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ─── STATS STRIP ──────────────────────────────── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.green::before { background: var(--green); }
.stat-card.amber::before { background: var(--accent); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.purple::before { background: var(--purple); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.stat-value.accent { color: var(--accent); }
.stat-value.green { color: var(--green); }
.stat-value.blue { color: var(--blue); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── TOOLBAR ──────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.filter-btn.active { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }

.toolbar-spacer { flex: 1; }

.add-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: #0a0b0f;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.add-btn:hover { background: #fbbf24; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }

/* ─── CALENDAR GRID ────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 0 8px;
}

.cal-row { display: contents; }

.cal-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 8px;
  min-height: 110px;
  transition: border-color var(--transition), background var(--transition);
}

.cal-cell:hover { border-color: var(--border); background: var(--bg-elevated); }

.cal-cell.today {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.cal-cell.empty { background: transparent; border-color: transparent; min-height: 60px; }
.cal-cell.empty:hover { background: transparent; }

.cal-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: right;
}

.cal-cell.today .cal-date { color: var(--accent); }

.cal-date-num {
  font-size: 18px;
  font-family: var(--font-display);
  font-weight: 700;
}

.cal-entries { display: flex; flex-direction: column; gap: 4px; }

/* ─── CALENDAR ENTRY CARDS ─────────────────────── */
.cal-entry {
  padding: 6px 8px;
  border-radius: 5px;
  border-left: 2px solid;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.cal-entry:hover { transform: translateX(2px); box-shadow: var(--shadow); }

.cal-entry.published { border-color: var(--green); background: var(--green-dim); }
.cal-entry.scheduled { border-color: var(--blue); background: var(--blue-dim); }
.cal-entry.recording { border-color: var(--purple); background: var(--purple-dim); }
.cal-entry.editing { border-color: var(--yellow); background: var(--yellow-dim); }
.cal-entry.queued { border-color: var(--text-muted); background: var(--bg-elevated); }
.cal-entry.archived { border-color: var(--border); background: var(--bg-surface); opacity: 0.5; }

.cal-entry-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cal-entry-topic {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-entry-score {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--accent);
  margin-top: 3px;
}

/* ─── LIST VIEW ────────────────────────────────── */
.list-view { display: none; flex-direction: column; gap: 8px; }
.list-view.active { display: flex; }
.calendar-grid.hidden { display: none; }

.list-entry {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.list-entry:hover { border-color: var(--border); background: var(--bg-elevated); transform: translateY(-1px); box-shadow: var(--shadow); }

.list-entry-left { display: flex; flex-direction: column; gap: 4px; }

.list-entry-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-display);
}

.list-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.list-entry-topic {
  font-size: 13px;
  color: var(--text-dim);
}

.list-entry-reason {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.list-entry-score {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  min-width: 56px;
}

.list-entry-date {
  font-size: 13px;
  color: var(--text-dim);
  text-align: right;
  min-width: 100px;
}

.list-entry-status { text-align: right; }

/* ─── STATUS BADGES ────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge.published { background: var(--green-dim); color: var(--green); }
.badge.published::before { background: var(--green); }
.badge.scheduled { background: var(--blue-dim); color: var(--blue); }
.badge.scheduled::before { background: var(--blue); }
.badge.recording { background: var(--purple-dim); color: var(--purple); }
.badge.recording::before { background: var(--purple); }
.badge.editing { background: var(--yellow-dim); color: var(--yellow); }
.badge.editing::before { background: var(--yellow); }
.badge.queued { background: var(--bg-elevated); color: var(--text-dim); }
.badge.queued::before { background: var(--text-muted); }
.badge.archived { background: var(--bg-surface); color: var(--text-muted); }
.badge.archived::before { background: var(--border); }

/* ─── EMPTY STATE ──────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 12px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.6;
}

/* ─── ENTRY DETAIL DRAWER ──────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 18px;
}

.drawer-close:hover { background: var(--bg-hover); color: var(--text); }

.drawer-body { padding: 24px; flex: 1; }

.drawer-score {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--accent-dim);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.drawer-score-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
}

.drawer-score-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

.drawer-section { margin-bottom: 24px; }

.drawer-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drawer-value { font-size: 15px; color: var(--text); line-height: 1.5; }

.drawer-trend-reason {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border-left: 2px solid var(--accent);
}

.drawer-schedule-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.date-input:focus { outline: none; border-color: var(--accent); }

.status-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}

.status-select:focus { outline: none; border-color: var(--accent); }

.save-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #0a0b0f;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}

.save-btn:hover { background: #fbbf24; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }

/* ─── SIGNAL BARS ──────────────────────────────── */
.signal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.signal-label { font-size: 12px; color: var(--text-muted); width: 60px; flex-shrink: 0; }

.signal-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.signal-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.signal-fill.trend { background: var(--green); }
.signal-fill.competition { background: var(--blue); }
.signal-fill.score { background: var(--accent); }

.signal-value { font-size: 12px; font-weight: 600; color: var(--text-dim); min-width: 28px; text-align: right; }

/* ─── VIEW TOGGLE ──────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  padding: 3px;
  gap: 2px;
}

.view-toggle button {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.view-toggle button.active { background: var(--bg-elevated); color: var(--text); }
.view-toggle button:hover:not(.active) { color: var(--text); }

/* ─── RESPONSIVE ────────────────────────────────── */
@media (max-width: 900px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .calendar-grid { grid-template-columns: repeat(7, minmax(80px, 1fr)); overflow-x: auto; }
  .list-entry { grid-template-columns: 1fr auto; }
  .list-entry-date, .list-entry-status { display: none; }
  .page { padding: 20px 16px 60px; }
}

@media (max-width: 600px) {
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; gap: 12px; }
  .drawer { width: 100%; }
}

/* ─── ANIMATIONS ────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cal-cell, .list-entry { animation: fadeIn 0.3s ease both; }

.cal-cell:nth-child(1) { animation-delay: 0.02s; }
.cal-cell:nth-child(2) { animation-delay: 0.04s; }
.cal-cell:nth-child(3) { animation-delay: 0.06s; }
.cal-cell:nth-child(4) { animation-delay: 0.08s; }
.cal-cell:nth-child(5) { animation-delay: 0.1s; }
.cal-cell:nth-child(6) { animation-delay: 0.12s; }
.cal-cell:nth-child(7) { animation-delay: 0.14s; }

/* Priority dot */
.priority-high { color: var(--red); }
.priority-medium { color: var(--yellow); }
.priority-low { color: var(--text-muted); }

/* Schedule action button */
.schedule-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}

.schedule-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }