/* PEER Audit Report Styles */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-700-normal.woff2') format('woff2');
}

:root {
  --bg: #fafafa;
  --fg: #1a1a2e;
  --card: #ffffff;
  --card-border: #e5e7eb;
  --muted: #6b7280;
  --primary: #eab308;
  --primary-dark: #ca8a04;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== PASSWORD GATE ===== */
.gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
}

.gate-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 3rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.gate-logo { width: 48px; height: 48px; margin-bottom: 1.5rem; }

.gate-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.gate-card p {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.gate-form { display: flex; gap: 0.5rem; }

.gate-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.gate-input:focus { border-color: var(--primary); }

.gate-btn {
  padding: 0.75rem 1.5rem;
  background: var(--fg);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.gate-btn:hover { opacity: 0.85; }

.gate-error {
  display: none;
  color: var(--red);
  font-size: 0.8125rem;
  margin-top: 0.75rem;
}

/* ===== REPORT LAYOUT ===== */
.report { display: none; }

.report-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
  color: #fff;
  padding: 2rem 0;
}

.report-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.report-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.report-logo { height: 36px; width: auto; }

.report-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 999px;
  padding: 0.375rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.report-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.report-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 0.9375rem;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
}

.report-meta span { display: flex; align-items: center; gap: 0.375rem; }

/* ===== MAIN BODY ===== */
.report-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== SCORE OVERVIEW ===== */
.score-overview {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.overall-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 1rem;
}

.score-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.score-ring circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.score-ring .bg { stroke: #e5e7eb; }
.score-ring .fill { transition: stroke-dashoffset 1s ease; }

.score-ring .value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
}

.score-grade {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.score-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pillar-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.pillar-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.pillar-card .pillar-name {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.pillar-card .pillar-score {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.pillar-card .pillar-grade {
  font-size: 0.875rem;
  font-weight: 600;
}

.pillar-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.pillar-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease;
}

/* Score colors */
.grade-a { color: var(--green); }
.grade-b { color: #059669; }
.grade-c { color: var(--orange); }
.grade-d { color: var(--red); }
.grade-f { color: #991b1b; }

.fill-a { stroke: var(--green); }
.fill-b { stroke: #059669; }
.fill-c { stroke: var(--orange); }
.fill-d { stroke: var(--red); }
.fill-f { stroke: #991b1b; }

.bar-a { background: var(--green); }
.bar-b { background: #059669; }
.bar-c { background: var(--orange); }
.bar-d { background: var(--red); }
.bar-f { background: #991b1b; }

/* ===== SECTION CARDS ===== */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--card-border);
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ===== ALERT BANNERS ===== */
.alert {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.alert-critical {
  background: var(--red-bg);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warning {
  background: var(--orange-bg);
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.alert-info {
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-success {
  background: var(--green-bg);
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* ===== STAT GRID ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--card-border);
  white-space: nowrap;
}

tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: top;
}

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

tbody tr:hover { background: #f9fafb; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-critical { background: #fef2f2; color: #991b1b; }
.badge-serious { background: #fff7ed; color: #9a3412; }
.badge-moderate { background: #fefce8; color: #854d0e; }
.badge-minor { background: #eff6ff; color: #1e40af; }
.badge-pass { background: var(--green-bg); color: #166534; }
.badge-fail { background: var(--red-bg); color: #991b1b; }
.badge-warning { background: var(--orange-bg); color: #9a3412; }
.badge-na { background: #f3f4f6; color: #6b7280; }

/* ===== ISSUE LIST ===== */
.issue-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--card-border);
}

.issue-item:last-child { border-bottom: none; }

.issue-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.issue-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.issue-detail {
  color: var(--muted);
  font-size: 0.8125rem;
}

.issue-count {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}

code {
  background: #f3f4f6;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  word-break: break-all;
}

/* ===== TOGGLE / ACCORDION ===== */
.toggle-btn {
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  margin-top: 0.75rem;
  transition: background 0.2s;
}

.toggle-btn:hover { background: #f3f4f6; }

.toggle-content { display: none; margin-top: 1rem; }
.toggle-content.open { display: block; }

/* ===== JEDI GRID ===== */
.jedi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.jedi-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.jedi-item h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.jedi-item p {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ===== ISO SECTION ===== */
.iso-highlight {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border: 2px solid #fecaca;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.iso-highlight h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.iso-highlight p {
  font-size: 0.875rem;
  color: #9a3412;
  line-height: 1.6;
}

/* ===== PROGRESS BAR ===== */
.progress {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
}

/* ===== FOOTER ===== */
.report-footer {
  background: var(--fg);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 2rem;
  font-size: 0.75rem;
}

.report-footer a { color: var(--primary); text-decoration: none; }
.report-footer a:hover { text-decoration: underline; }

/* ===== PRINT ===== */
@media print {
  .gate { display: none !important; }
  .report { display: block !important; }
  .report-header { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .toggle-content { display: block !important; }
  .toggle-btn { display: none; }
  body { font-size: 10pt; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .score-overview {
    grid-template-columns: 1fr;
  }
  .pillar-scores {
    grid-template-columns: repeat(2, 1fr);
  }
  .report-title { font-size: 1.375rem; }
  .report-header-top { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .jedi-grid { grid-template-columns: 1fr; }
  .gate-form { flex-direction: column; }
}

@media (max-width: 480px) {
  .pillar-scores { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}
