/* ============================================
   Executive Briefing — Design System
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
.exec-summary-text ul,
.competitor-summary ul {
  list-style: disc;
  padding-left: 1.25em;
  margin: 0.4rem 0 0.6rem;
}
.exec-summary-text li,
.competitor-summary li {
  margin-bottom: 0.35rem;
  line-height: 1.6;
}
.exec-summary-text li::marker {
  color: rgba(67, 97, 238, 0.5);
}
.competitor-summary li::marker {
  color: var(--accent);
}
button, input, select, textarea { font: inherit; }

/* --- Typography --- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Colors */
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #4361ee;
  --content-bg: #f0f2f5;
  --card-bg: #ffffff;
  --accent: #4361ee;
  --accent-light: rgba(67, 97, 238, 0.08);
  --text-heading: #1a1a2e;
  --text-body: #4a5568;
  --text-muted: #94a3b8;
  --border-light: #e2e8f0;

  /* Threat / Impact */
  --threat-low: #10b981;
  --threat-moderate: #f59e0b;
  --threat-elevated: #ef4444;
  --threat-high: #dc2626;
  --impact-1: #94a3b8;
  --impact-2: #10b981;
  --impact-3: #f59e0b;
  --impact-4: #ef4444;
  --impact-5: #dc2626;

  /* Subtle border variants for high-impact cards */
  --impact-border-3: #fde68a;
  --impact-border-4: #fecaca;
  --impact-border-5: #fca5a5;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Layout */
  --sidebar-width: 270px;
}

body {
  font-family: var(--font-sans);
  font-size: 0.925rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--content-bg);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }

p { margin-bottom: 0.5rem; }
strong { font-weight: 600; }
code {
  background: var(--accent-light);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

/* --- App Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand h1 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.15rem;
  letter-spacing: -0.01em;
}
.sidebar-brand .subtitle {
  font-size: 0.72rem;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}
.sidebar-nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 0.75rem 1.25rem 0.35rem;
  font-weight: 600;
}
.sidebar-nav a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-size: 0.84rem;
  color: var(--sidebar-text);
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}
.sidebar-nav a.active {
  background: var(--sidebar-hover);
  color: #ffffff;
  border-left-color: var(--sidebar-active);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Main Content --- */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2rem;
  min-height: 100vh;
  max-width: 100%;
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: fadeInUp 0.4s ease both;
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* --- Report Header --- */
.report-header {
  margin-bottom: 1.5rem;
}
.report-header h2 {
  margin-bottom: 0.25rem;
}
.report-header .report-meta {
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* --- Stat Ribbon --- */
.stat-ribbon {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeInUp 0.4s ease both;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}
.stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  margin-top: 0.2rem;
}
.stat-number.accent { color: var(--accent); }
.stat-number.threat { color: var(--threat-elevated); }

/* --- Exec Summary --- */
.exec-summary {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%);
  color: #e2e8f0;
  border-radius: 10px;
  padding: 2rem 2.25rem;
  margin-bottom: 1.75rem;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.25s;
}
.exec-summary::before {
  content: "\201C";
  position: absolute;
  top: -0.15rem;
  left: 1rem;
  font-size: 6rem;
  color: rgba(67, 97, 238, 0.15);
  font-family: Georgia, serif;
  line-height: 1;
}
.exec-summary h3 {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.exec-summary-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #f1f5f9;
  position: relative;
  z-index: 1;
}
.exec-summary-text p {
  color: #f1f5f9;
  margin-bottom: 0.5rem;
}
.exec-summary-text p:last-child { margin-bottom: 0; }
.exec-summary-text strong { font-weight: 600; color: #ffffff; }

/* --- High-Impact Items --- */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title .icon {
  font-size: 1.1rem;
}

.high-impact-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.high-impact-card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--impact-border-3);
  transition: box-shadow 0.2s ease;
  animation: fadeInUp 0.4s ease both;
}
.high-impact-card:hover {
  box-shadow: var(--shadow-md);
}
.high-impact-card.impact-4 { border-left-color: var(--impact-border-4); }
.high-impact-card.impact-5 { border-left-color: var(--impact-border-5); }

.hi-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.hi-card-headline {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--text-heading);
  line-height: 1.4;
}
.hi-card-detail {
  font-size: 0.88rem;
  color: var(--text-body);
  margin: 0;
  line-height: 1.6;
}

/* Badges */
.impact-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}
.impact-1 { background: #f1f5f9; color: #64748b; }
.impact-2 { background: #ecfdf5; color: #059669; }
.impact-3 { background: #fffbeb; color: #d97706; }
.impact-4 { background: #fef2f2; color: #dc2626; }
.impact-5 { background: #fef2f2; color: #b91c1c; }

.competitor-tag, .category-tag {
  font-size: 0.7rem;
  padding: 0.15em 0.55em;
  border-radius: 3px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}
.category-tag {
  background: rgba(0,0,0,0.05);
  color: var(--text-muted);
}

.threat-badge {
  display: inline-block;
  padding: 0.2em 0.65em;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  text-transform: uppercase;
}
.threat-low { background: var(--threat-low); }
.threat-moderate { background: var(--threat-moderate); }
.threat-elevated { background: var(--threat-elevated); }
.threat-high { background: var(--threat-high); animation: pulse 2s ease-in-out infinite; }

.source-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-left: 0.25em;
}
.source-link:hover {
  text-decoration: underline;
  color: #2d4ad0;
}

/* --- Competitor Grid --- */
.competitor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.competitor-card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
  animation: fadeInUp 0.4s ease both;
}
.competitor-card:hover {
  box-shadow: var(--shadow-md);
}

.competitor-card-stripe {
  height: 4px;
}
.competitor-card-stripe.threat-low { background: var(--threat-low); }
.competitor-card-stripe.threat-moderate { background: var(--threat-moderate); }
.competitor-card-stripe.threat-elevated { background: var(--threat-elevated); }
.competitor-card-stripe.threat-high { background: var(--threat-high); }
.competitor-card-stripe.threat-none { background: var(--border-light); }

.competitor-card-body {
  padding: 1.25rem;
}
.competitor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.competitor-card-header h3 {
  font-size: 1.1rem;
  margin: 0;
}

.competitor-summary {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.6;
  margin-bottom: 0.65rem;
}
/* Intel bullet list in competitor cards */
.intel-bullets {
  list-style: disc;
  padding-left: 1.25em;
  margin: 0.25rem 0 0.75rem;
}
.intel-bullets li {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-body);
  margin-bottom: 0.4rem;
}
.intel-bullets li::marker {
  color: var(--accent);
}

.nothing-notable {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.88rem;
  padding: 0.5rem 0;
}

/* Details/Summary inside competitor cards */
.competitor-card details {
  border-top: 1px solid var(--border-light);
  margin-top: 0.5rem;
}
.competitor-card details + details {
  margin-top: 0;
}
.competitor-card summary {
  padding: 0.6rem 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  user-select: none;
}
.competitor-card summary::-webkit-details-marker { display: none; }
.competitor-card summary::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.competitor-card details[open] > summary::before {
  transform: rotate(45deg);
}
.competitor-card .count-badge {
  font-size: 0.7rem;
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
  padding: 0.1em 0.45em;
  border-radius: 3px;
  font-weight: 600;
}

/* Intel items inside details */
.intel-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-light);
}
.intel-item:last-child { border-bottom: none; }
.item-header {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0.15em;
}
.item-header h5 {
  font-size: 0.88rem;
  margin: 0;
  flex: 1;
}
.intel-item p {
  font-size: 0.84rem;
  margin: 0.1rem 0 0.3rem;
  color: var(--text-body);
  line-height: 1.55;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}
.empty-state h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 0.75rem;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .sidebar-brand {
    border-bottom: none;
    padding: 0.75rem 1.25rem;
  }
  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    padding: 0 0.5rem 0.5rem;
    gap: 0;
  }
  .sidebar-nav-label { display: none; }
  .sidebar-nav a {
    padding: 0.35rem 0.75rem;
    border-left: none;
    border-radius: 4px;
    font-size: 0.78rem;
  }
  .sidebar-nav a.active { border-left-color: transparent; }
  .sidebar-footer {
    display: none;
  }
  .app-layout { flex-direction: column; }
  .content {
    margin-left: 0;
    padding: 1.25rem;
  }
}

@media (max-width: 768px) {
  .competitor-grid { grid-template-columns: 1fr; }
  .stat-ribbon { flex-wrap: wrap; }
  .stat-card { flex: 1 1 calc(50% - 0.5rem); }
  .exec-summary { padding: 1.5rem; }
}

/* --- Print --- */
@media print {
  .sidebar { display: none !important; }
  .content { margin-left: 0 !important; padding: 0 !important; }
  .card, .stat-card, .competitor-card, .high-impact-card, .exec-summary {
    box-shadow: none !important;
    break-inside: avoid;
  }
  .exec-summary {
    background: #f0f2f5 !important;
    color: #1a1a2e !important;
  }
  .exec-summary h3, .exec-summary-text { color: #1a1a2e !important; }
  .competitor-grid { grid-template-columns: 1fr; }
  body { background: #fff; }
  .stat-card:hover { transform: none; }
  * { animation: none !important; }
}
