/* ========================================
   Out Sauce Security Submission Pack
   Design System — Polished
   ======================================== */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-alt: #F7F8FA;
  --sidebar-bg: #FAFBFC;
  --sidebar-border: #EAECF0;
  --text-primary: #1A1D26;
  --text-secondary: #4A4F63;
  --text-muted: #8B90A3;
  --accent: #2A9D8F;
  --accent-hover: #238B7E;
  --accent-soft: rgba(42, 157, 143, 0.06);
  --accent-light: rgba(42, 157, 143, 0.1);
  --accent-badge: #E8F5F3;
  --border: #E5E7EB;
  --border-light: #F0F1F3;
  --border-focus: rgba(42, 157, 143, 0.5);
  --table-header-bg: #1A1D26;
  --table-header-text: #FFFFFF;
  --table-stripe: #F9FAFB;
  --warm-bg: #FEFCFA;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-sm: 6px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-focus: 0 0 0 3px rgba(42, 157, 143, 0.15);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;
  --sidebar-width: 288px;
  --mobile-header-height: 56px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.65;
}

/* ========================================
   Password Screen
   ======================================== */

.password-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #F7F8FA 0%, #EEF0F4 50%, #E8EAF0 100%);
  z-index: 1000;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.password-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.password-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 44px 48px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.password-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 28px;
  object-fit: contain;
}

.password-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.password-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.password-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 3px;
  background: var(--surface-alt);
}

.password-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
  background: var(--surface);
}

.password-btn {
  width: 100%;
}

.password-error {
  color: #c45a52;
  font-size: 0.85rem;
  margin-top: 12px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-4px); }
  30%, 70% { transform: translateX(4px); }
}

.password-card.shake {
  animation: shake 0.4s ease;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(42, 157, 143, 0.25);
  transform: translateY(-1px);
}

.btn-download {
  background: var(--accent);
  color: white;
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-download:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(42, 157, 143, 0.25);
}

.btn-secondary-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 16px;
  margin-top: 8px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-secondary-download:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Per-document download button */
.doc-download-btn {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
  margin-top: 4px;
}

.doc-download-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ========================================
   App Layout
   ======================================== */

.app {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   Mobile Header
   ======================================== */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  gap: 12px;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.9);
}

.hamburger {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-base);
}

.mobile-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
}

.sidebar-header {
  padding: 32px 24px 24px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin-bottom: 14px;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-group {
  margin-bottom: 8px;
}

.nav-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 14px 6px;
}

.nav-item {
  display: block;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-left: 2.5px solid transparent;
  margin-bottom: 1px;
  line-height: 1.4;
}

.nav-item:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ========================================
   Content Area
   ======================================== */

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 52px 64px 96px;
  max-width: 960px;
}

.content-section {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Document Metadata Block
   ======================================== */

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin: 16px 0 28px;
  padding: 16px 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  text-align: center;
}

.meta-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.meta-label {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  white-space: nowrap;
}

.meta-value {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Separator between meta items */
.meta-item:not(:last-child)::after {
  content: '';
  display: inline-block;
  width: 1px;
  height: 14px;
  background: var(--border);
  margin-left: 12px;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .doc-meta {
    gap: 6px 8px;
    padding: 12px 14px;
  }

  .meta-item:not(:last-child)::after {
    display: none;
  }

  .meta-item {
    flex-basis: 100%;
  }
}

/* ========================================
   Document Content Styling
   ======================================== */

.content-section h1 {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.content-section h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 44px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* First h2 after the metadata box — no extra top gap */
.doc-meta + hr + h2,
.doc-meta + h2 {
  margin-top: 0;
}

.content-section h3 {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 12px;
}

.content-section h4 {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 20px;
  margin-bottom: 8px;
}

.content-section p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.72;
}

.content-section ul, .content-section ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content-section li {
  margin-bottom: 6px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.content-section li::marker {
  color: var(--accent);
}

.content-section strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content-section blockquote {
  border-left: 3px solid var(--accent);
  padding: 14px 22px;
  margin: 20px 0;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.content-section hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 36px 0;
}

/* No special styling for first paragraph — metadata is now handled by .doc-meta */

/* ========================================
   Tables
   ======================================== */

.table-wrap {
  overflow-x: auto;
  margin: 20px 0 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  line-height: 1.55;
}

thead tr {
  background: var(--table-header-bg);
}

thead th {
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--table-header-text);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

thead th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

thead th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

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

tbody tr:nth-child(even) {
  background: var(--table-stripe);
}

tbody tr:hover {
  background: var(--accent-soft);
}

tbody td {
  padding: 10px 16px;
  color: var(--text-secondary);
  vertical-align: top;
}

tbody td:first-child {
  font-weight: 500;
  color: var(--text-primary);
}

tbody td del {
  color: var(--text-muted);
}

/* ========================================
   Status Badges (Compliance Matrix)
   ======================================== */

.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-badge.met {
  background: #F0F1F3;
  color: #555770;
}

.status-badge.exceeds {
  background: var(--accent-badge);
  color: var(--accent);
}

/* ========================================
   Compliance Matrix Controls
   ======================================== */

.matrix-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-sm);
}

.matrix-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  min-width: 110px;
  flex: 1;
  border: 1px solid var(--border-light);
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.exceeds-stat {
  border-color: rgba(42, 157, 143, 0.2);
  background: rgba(42, 157, 143, 0.04);
}

.exceeds-stat .stat-number {
  color: var(--accent);
}

.progress-number {
  color: var(--accent);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.matrix-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-btn {
  padding: 7px 18px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(42, 157, 143, 0.2);
}

.matrix-search input {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  background: var(--surface-alt);
}

.matrix-search input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
  background: var(--surface);
}

/* ========================================
   PDF Embed
   ======================================== */

.pdf-render {
  margin-top: 24px;
  width: 100%;
}

.pdf-render canvas {
  display: block;
  width: 100%;
  height: auto;
}

.pdf-loading {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.pdf-download {
  margin-top: 20px;
  text-align: center;
}

.doc-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
}

.doc-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .content {
    margin-left: 0;
    padding: 80px 20px 48px;
  }

  .matrix-summary {
    gap: 10px;
  }

  .summary-stat {
    min-width: 70px;
    padding: 12px 10px;
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .matrix-filters {
    flex-wrap: wrap;
  }

  thead th {
    font-size: 0.7rem;
    padding: 8px 10px;
  }

  tbody td {
    font-size: 0.78rem;
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .password-card {
    padding: 36px 24px;
  }

  .content {
    padding: 72px 16px 32px;
  }

  .content-section h1 {
    font-size: 1.4rem;
  }

  .content-section h2 {
    font-size: 1.05rem;
  }
}

/* ========================================
   Scrollbar
   ======================================== */

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Selection
   ======================================== */

::selection {
  background: var(--accent-light);
  color: var(--text-primary);
}

/* ========================================
   Focus styles (accessibility)
   ======================================== */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
