/* =============================================================================
   WhyMyRating — Reputation Blueprint Design System
   Premium magazine-style report layout
   ============================================================================= */

/* ---------- Google Fonts (loaded via next/font in layout.tsx) ---------- */

/* ---------- CSS Variables ---------- */
:root {
  /* Brand Logo Colors */
  --brand-star: #FBBC05;
  --brand-magnifier: #1E293B;
  --brand-lens: #FEF3C7;
  --brand-bar-light: #86EFAC;
  --brand-bar-mid: #22C55E;
  --brand-bar-dark: #15803D;
  --brand-accent: #F59E0B;

  /* UI Colors */
  --ui-primary: #4285F4;
  --ui-primary-hover: #1E40AF;
  --ui-success: #34A853;
  --ui-error: #EA4335;

  /* Surfaces */
  --surface-page: #F8FAFC;
  --surface-card: #FFFFFF;
  --surface-muted: #F1F5F9;
  --surface-dark: #1E293B;

  /* Text */
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-inverse: #FAFAFA;

  /* Layout */
  --border-light: #E2E8F0;
  --radius-brand: 10px;
  --font-sans: var(--font-inter), 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-wordmark: var(--font-nunito), 'Nunito', sans-serif;
}

/* ---------- Page System (A4 proportion: 1024×1448px) ---------- */
.page {
  width: 1024px;
  min-height: 1448px;    /* min-height instead of fixed — content can grow */
  overflow: visible;     /* no scroll trap in web demo */
  position: relative;
  margin: 0 auto 32px;   /* 32px gap between pages for printed-document look */
  background: var(--surface-card);
  page-break-after: always;
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  border-radius: 2px;
}

.page-content {
  display: flex;
  flex-direction: column;
  padding: 64px 77px 90px;
  min-height: 100%;
  box-sizing: border-box;
  position: relative;
}

/* Page background variants */
.page-bg-white { background: var(--surface-card); }
.page-bg-gray { background: var(--surface-page); }
.page-bg-dark {
  background: linear-gradient(155deg, #1E293B 0%, #0F172A 100%);
  color: var(--text-inverse);
}

/* ---------- Typography ---------- */
.display-xl {
  font-family: var(--font-sans);
  font-size: 52px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.display-lg {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.display-md {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.heading-lg {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.heading-md {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
}

.body-lg {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
}

.body-md {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
}

.body-sm {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
}

.caption {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Text color helpers */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-inverse { color: var(--text-inverse); }
.text-brand { color: var(--ui-primary); }

/* ---------- Page Header & Footer ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.page-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-indicator {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  margin-top: auto;      /* push to bottom when content is short */
}

.page-footer-text {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
}

/* ---------- Section Header ---------- */
.section-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ui-primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.section-lead {
  max-width: 600px;
}

/* ---------- Insight Callout ---------- */
.insight-callout {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  border-left: 4px solid var(--ui-primary);
  border-radius: 0 var(--radius-brand) var(--radius-brand) 0;
  padding: 20px 24px;
  margin: 16px 0;
}

.insight-callout.green {
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
  border-left-color: var(--ui-success);
}

/* ---------- Alert Block ---------- */
.alert-block {
  background: linear-gradient(135deg, #FEF2F2 0%, #FECACA40 100%);
  border-left: 4px solid var(--ui-error);
  border-radius: 0 var(--radius-brand) var(--radius-brand) 0;
  padding: 16px 20px;
  margin: 16px 0;
}

.alert-block .alert-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ui-error);
  margin-bottom: 6px;
}

/* ---------- Stats Grid ---------- */
.stats-row {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 12px;
  background: var(--surface-muted);
  border-radius: var(--radius-brand);
}

.stat-item.dark {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-item.dark .stat-label {
  color: rgba(255,255,255,0.6);
}

/* ---------- Score Bar ---------- */
.score-bar-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-bar-label {
  width: 130px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.score-bar-track {
  flex: 1;
  height: 10px;
  background: var(--surface-muted);
  border-radius: 5px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.score-bar-value {
  width: 50px;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

/* ---------- Scoring Table (dark style) ---------- */
.scoring-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-brand);
  overflow: hidden;
}

.scoring-table thead th {
  background: var(--surface-dark);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
}

.scoring-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}

.scoring-table tbody tr:nth-child(even) {
  background: var(--surface-muted);
}

.scoring-table tbody tr:last-child td {
  border-bottom: none;
}

.score-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.score-badge.green {
  background: #DCFCE7;
  color: #15803D;
}

.score-badge.amber {
  background: #FEF3C7;
  color: #92400E;
}

/* ---------- Complaint / Issue List ---------- */
.issue-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-brand);
  margin-bottom: 14px;
}

.issue-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FEE2E2;
  color: #DC2626;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.issue-rank.green {
  background: #DCFCE7;
  color: #16A34A;
}

.issue-body {
  flex: 1;
  min-width: 0;
}

.issue-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.issue-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.complexity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.complexity-badge.quick { background: #DCFCE7; color: #15803D; }
.complexity-badge.medium { background: #DBEAFE; color: #1D4ED8; }
.complexity-badge.complex { background: #FEF3C7; color: #92400E; }

/* ---------- Blockquote ---------- */
.evidence-quote {
  border-left: 3px solid var(--border-light);
  padding: 8px 16px;
  margin: 8px 0;
  font-style: italic;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.evidence-quote.red { border-left-color: #FCA5A5; }
.evidence-quote.green { border-left-color: #86EFAC; }
.evidence-quote.blue { border-left-color: #93C5FD; }

/* ---------- Framework / Strength Items ---------- */
.framework-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-brand);
  margin-bottom: 14px;
}

.framework-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ui-primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.framework-number.green {
  background: var(--ui-success);
}

.framework-body {
  flex: 1;
  min-width: 0;
}

/* ---------- Info Block ---------- */
.info-block {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 10px;
}

.info-block .info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.info-block.green {
  background: #F0FDF4;
}

.info-block.blue {
  background: #EFF6FF;
}

/* ---------- CTA Block ---------- */
.cta-block {
  background: linear-gradient(135deg, var(--ui-primary) 0%, #1E40AF 100%);
  border-radius: var(--radius-brand);
  padding: 32px;
  text-align: center;
  color: white;
  margin-top: 24px;
}

.cta-block h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cta-block p {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 16px;
}

/* ---------- Pill / Tag ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.pill.dark {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.15);
}

.pill.light {
  background: var(--surface-muted);
  color: var(--text-secondary);
}

/* ---------- Cover-specific ---------- */
.cover-score-gauge {
  margin: 32px 0 24px;
}

.cover-feature-pills {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ---------- Effort / Impact Badges ---------- */
.effort-badge, .impact-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.effort-badge.low { background: #DCFCE7; color: #15803D; }
.effort-badge.medium { background: #FEF3C7; color: #92400E; }
.effort-badge.high { background: #FEE2E2; color: #DC2626; }

.impact-badge.high { background: #DCFCE7; color: #15803D; }
.impact-badge.medium { background: #FEF3C7; color: #92400E; }
.impact-badge.low { background: #F3F4F6; color: #6B7280; }

/* ---------- Domain dot ---------- */
.domain-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
