/* ══════════════════════════════════════════════════════════════
   kuperman.ai — Economist-inspired editorial design
   Primary:   Northwestern Purple #4E2A84
   Secondary: Gold #B6A369
   ══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
  --purple: #4E2A84;
  --purple-dark: #3A1F63;
  --purple-light: #6B3FA0;
  --gold: #B6A369;
  --gold-light: #D4C48A;
  --gold-faint: #F5F0E3;

  --bg-white: #FFFFFF;
  --bg-warm: #FAF9F6;
  --bg-cream: #F5F3EE;

  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-tertiary: #7A7A7A;
  --text-light: #9A9A9A;

  --border: #E0DDD6;
  --border-light: #EDEAE3;

  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --pass: #1B7340;
  --pass-bg: #EDF7F0;
  --warn: #A66E0A;
  --warn-bg: #FDF6E8;
  --fail: #B91C1C;
  --fail-bg: #FEF0F0;

  --sidebar-bg: #1A1A1A;
  --sidebar-border: #2E2E2E;
  --sidebar-text: #A0A0A0;
  --sidebar-text-hover: #E0E0E0;
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 56px;
}

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

body {
  font-family: var(--sans);
  background: var(--bg-warm);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Loading / Spinner ── */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-warm);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login ── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-white);
}
.login-card {
  text-align: center;
  max-width: 400px;
  width: 90%;
  padding: 56px 48px;
}
.login-card::before {
  content: '';
  display: block;
  width: 48px;
  height: 4px;
  background: var(--purple);
  margin: 0 auto 32px;
}
.login-card h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.login-card p {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  margin-bottom: 40px;
}
.login-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--purple);
  color: white;
  border: none;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s;
}
.login-btn:hover { background: var(--purple-dark); }
.login-error {
  margin-top: 16px;
  color: var(--fail);
  font-size: 13px;
}

/* ── Dashboard Header ── */
.dash-header {
  background: var(--purple);
  color: white;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
}
.dash-header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}
.dash-header h1 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: white;
}
.date-picker {
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0;
  font-size: 13px;
  font-family: var(--sans);
  color: white;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
}
.date-picker::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
.dash-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-email {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.01em;
}
.logout-btn {
  padding: 5px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.15s;
}
.logout-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}

/* ── Accent rule beneath header ── */
.dash-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold);
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0 32px;
  margin-top: 28px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.stat-card {
  text-align: center;
  padding: 20px 16px 18px;
  border-right: 1px solid var(--border);
}
.stat-card:last-child { border-right: none; }
.stat-num {
  display: block;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-label {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-top: 6px;
}
.stat-card.pass .stat-num { color: var(--pass); }
.stat-card.warn .stat-num { color: var(--warn); }
.stat-card.fail .stat-num { color: var(--fail); }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px 20px;
  flex-wrap: wrap;
}
.filter-pills { display: flex; gap: 0; }
.pill {
  padding: 7px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-right: none;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.12s;
}
.pill:first-child { border-radius: 0; }
.pill:last-child { border-right: 1px solid var(--border); border-radius: 0; }
.pill:hover { color: var(--text-primary); background: var(--bg-cream); }
.pill.active {
  background: var(--purple);
  border-color: var(--purple);
  color: white;
}
.pill.active + .pill { border-left-color: var(--purple); }
.seg-select {
  padding: 7px 28px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--sans);
  color: var(--text-secondary);
  background: var(--bg-white);
  cursor: pointer;
  appearance: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A4A4A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* ── Review List ── */
.review-list {
  padding: 0 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-light);
  font-size: 15px;
  font-style: italic;
  font-family: var(--serif);
}

/* ── Review Card ── */
.review-card {
  background: var(--bg-white);
  border: none;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--text-light);
  overflow: hidden;
  transition: background 0.15s;
}
.review-card:first-child {
  border-top: 1px solid var(--border);
}
.review-card:hover { background: var(--bg-cream); }
.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
}
.review-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 0;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid;
}
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}
.segment-tag {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  background: var(--bg-cream);
  padding: 2px 8px;
  border-radius: 0;
  letter-spacing: 0.02em;
}
.reviewed-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple);
  background: #EDE6F6;
  padding: 2px 8px;
  border-radius: 0;
}
.expand-arrow { color: var(--text-light); font-size: 11px; }

/* ── Card Body ── */
.review-card-body { padding: 0 20px 20px; }
.flags-section { margin-bottom: 16px; }
.flags-section h4 {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-weight: 600;
}
.flag-item {
  font-size: 13px;
  color: var(--fail);
  padding: 8px 12px;
  background: var(--fail-bg);
  border-left: 3px solid var(--fail);
  margin-bottom: 4px;
  line-height: 1.5;
}
.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.meta-tag {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--bg-cream);
  border-radius: 0;
  color: var(--text-tertiary);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.02em;
}
.vision-tag {
  background: #EDE6F6;
  color: var(--purple);
  font-family: var(--sans);
  font-weight: 600;
}

/* ── Screenshot ── */
.screenshot-container {
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
  max-height: 500px;
  overflow-y: auto;
}
.screenshot-img {
  width: 100%;
  display: block;
}
.img-placeholder {
  padding: 40px;
  text-align: center;
  color: var(--text-light);
  background: var(--bg-cream);
  font-style: italic;
  font-family: var(--serif);
  font-size: 14px;
}

/* ── Feedback ── */
.feedback-section {
  background: var(--bg-cream);
  border: 1px solid var(--border);
  padding: 16px;
}
.feedback-section h4 {
  font-family: var(--sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  font-weight: 600;
}
.feedback-verdicts {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.verdict-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-white);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 0.12s;
}
.verdict-btn:hover { border-color: var(--text-light); color: var(--text-primary); }
.verdict-btn.selected { font-weight: 700; }
.feedback-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 0;
  font-size: 14px;
  font-family: var(--sans);
  resize: vertical;
  margin-bottom: 10px;
  background: var(--bg-white);
  color: var(--text-primary);
  line-height: 1.5;
}
.feedback-input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple);
}
.save-btn {
  padding: 9px 24px;
  background: var(--purple);
  color: white;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s;
}
.save-btn:hover { background: var(--purple-dark); }
.save-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── App Layout (sidebar + main) ── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.2s ease;
}
.sidebar-collapsed { width: var(--sidebar-width-collapsed); }
.sidebar-collapsed ~ .app-main { margin-left: 0; }

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand::after {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--gold);
  margin-top: 12px;
}

.sidebar-section-label {
  padding: 16px 20px 8px;
  font-family: var(--sans);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #555;
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all 0.12s;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  white-space: nowrap;
}
.sidebar-item:hover {
  background: var(--sidebar-border);
  color: var(--sidebar-text-hover);
}
.sidebar-item.active {
  background: var(--purple);
  color: white;
}

.sidebar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-live { background: #34D399; }
.dot-wip { background: #FBBF24; }
.dot-idea { background: #555; }

.sidebar-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-status {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
}
.sidebar-status-wip { color: #FBBF24; background: rgba(251,191,36,0.12); }
.sidebar-status-idea { color: #888; background: rgba(136,136,136,0.12); }

.sidebar-footer {
  margin-top: auto;
  padding-bottom: 8px;
}
.sidebar-user {
  padding: 4px 20px 8px;
  font-family: var(--sans);
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  margin: 4px 8px 8px;
  background: transparent;
  border: 1px solid var(--sidebar-border);
  color: #666;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--sans);
  transition: all 0.12s;
}
.sidebar-collapse-btn:hover { color: #aaa; border-color: #555; }

/* ── Main content area ── */
.app-main {
  min-height: 100vh;
  overflow-y: auto;
  background: var(--bg-warm);
}

/* ── Dashboard header breadcrumb ── */
.dash-breadcrumb {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.02em;
}
.dash-breadcrumb-sep {
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  margin: 0 2px;
}

/* ── Placeholder views for future apps ── */
.placeholder-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
}
.placeholder-content {
  text-align: center;
  max-width: 480px;
}
.placeholder-content h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.placeholder-content p {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-bottom: 20px;
}
.placeholder-tag {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 4px 12px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: var(--sidebar-width-collapsed) 1fr;
  }
  .sidebar { width: var(--sidebar-width-collapsed); }
  .sidebar-item-name,
  .sidebar-status,
  .sidebar-user,
  .sidebar-section-label { display: none; }
  .sidebar-logo { font-size: 16px; }
  .sidebar-brand::after { width: 16px; }
}
@media (max-width: 640px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(2) { border-right: none; }
  .dash-header {
    flex-direction: column;
    height: auto;
    padding: 12px 20px;
    gap: 8px;
    align-items: flex-start;
  }
  .dash-header::after { height: 3px; }
  .filter-bar { flex-direction: column; align-items: flex-start; padding: 0 20px 16px; }
  .review-list { padding: 0 20px 32px; }
  .stats-row { padding: 0 20px; margin-top: 20px; }
}
