@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Typography Variables */

:root {
  --font-logo: 'Changeling Neo Light', system-ui, sans-serif;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Monaco', 'Courier New', monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  width: 100%;
}/* CSS Custom Properties for Theme Integration */
:root {
  --primary-main: var(--primary-main);
  --text-primary: var(--primary-main);
  --text-secondary: #666666;
  --text-on-primary: #ffffff;
  --bg-default: #ffffff;
  --bg-paper: #fafafa;
  --bg-hover: #f5f5f5;
  --bg-dark: #0a0a0a;
  --divider: #e5e5e5;
  --success-main: #404040;
  --success-light: #f0f0f0;
  --success-dark: #202020;
  --warning-main: #606060;
  --warning-light: #f8f8f8;
  --warning-dark: #404040;
  --info-main: #404040;
  --error-main: #303030;
  --error-light: #f0f0f0;
  --error-dark: #202020;
}

[data-theme="dark"] {
  --primary-main: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-on-primary: var(--primary-main);
  --bg-default: var(--primary-main);
  --bg-paper: #0a0a0a;
  --bg-hover: #1a1a1a;
  --bg-dark: var(--primary-main);
  --divider: #1a1a1a;
  --success-main: #d4d4d4;
  --success-light: #2a2a2a;
  --success-dark: #ffffff;
  --warning-main: #a0a0a0;
  --warning-light: #1a1a1a;
  --warning-dark: #d4d4d4;
  --info-main: var(--divider);
  --error-main: #808080;
  --error-light: #1a1a1a;
  --error-dark: #ffffff;
}

/* Document Styling System - CMMC Compliance Documents */

/* ============================= */
/* Global Document Styles */
/* ============================= */
/* Basic typography now handled by theme provider - keeping container for other layout styles */

.document-container {
  /* Basic layout styles - typography handled by theme provider */
}

/* ============================= */
/* Typography Extensions */
/* ============================= */

.document-container em {
  font-style: italic;
}

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

/* Table wrapper for overflow handling */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.cmmc-table {
  width: 100%;
  min-width: 600px; /* Minimum width to prevent squishing */
  border-collapse: collapse;
  font-size: 0.95rem;
  overflow: hidden;
}

.cmmc-table thead {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  color: white;
}

.cmmc-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.025em;
}

.cmmc-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
}

.cmmc-table tbody tr:nth-child(even) {
  background-color: var(--bg-paper);
}

.cmmc-table tbody tr:hover {
  background-color: var(--bg-hover);
  transition: background-color 0.2s ease;
}

/* ============================= */
/* Control Matrix Specific */
/* ============================= */

.control-matrix-table {
  width: 100%;
  margin: 2rem 0;
}

.control-matrix-table .control-code {
  font-family: 'Monaco', 'Courier New', monospace;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-paper);
  padding: 2px 6px;
  border-radius: 3px;
}

.control-matrix-table .status-implemented {
  color: var(--success-main);
  font-weight: 600;
}

.control-matrix-table .status-partially_implemented {
  color: var(--warning-main);
  font-weight: 600;
}

.control-matrix-table .status-planned {
  color: var(--info-main);
  font-weight: 600;
}

.control-matrix-table .status-not_implemented {
  color: var(--error-main);
  font-weight: 600;
}

.control-matrix-table .status-not_applicable {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============================= */
/* Lists */
/* ============================= */

.document-container ul,
.document-container ol {
  margin: 1rem 0;
  padding-left: 2rem;
  color: var(--text-secondary);
}

.document-container li {
  margin: 0.5rem 0;
  line-height: 1.7;
}

.document-container ul li::marker {
  color: var(--primary-main);
}

.document-container ol li::marker {
  color: var(--text-primary);
  font-weight: 600;
}

/* Nested lists */
.document-container ul ul,
.document-container ol ol,
.document-container ul ol,
.document-container ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* ============================= */
/* Code Blocks */
/* ============================= */

.document-container pre {
  background: var(--text-primary);
  color: var(--divider);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.document-container code {
  background: var(--bg-hover);
  color: var(--error-main);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
}

.document-container pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* ============================= */
/* Alignment Classes */
/* ============================= */

.align-left {
  text-align: left;
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

.align-justify {
  text-align: justify;
}

/* ============================= */
/* Special Sections */
/* ============================= */

/* Cover Page */
.cover-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  page-break-after: always;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  color: white;
  padding: 4rem;
}

.cover-page h1 {
  font-size: 3.5rem;
  margin-bottom: 2rem;
  color: white;
  border: none;
}

.cover-page .subtitle {
  font-size: 1.5rem;
  color: var(--text-on-primary);
  margin-bottom: 3rem;
}

.cover-page .metadata {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 2;
}

/* Table of Contents */
.table-of-contents {
  margin: 2rem 0;
  padding: 2rem;
  background: var(--bg-paper);
  border-radius: 8px;
}

.table-of-contents h2 {
  color: var(--primary-main);
  border-bottom: 2px solid var(--primary-main);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.toc-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--divider);
}

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

.toc-title {
  color: var(--text-primary);
}

.toc-page {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================= */
/* Evidence & Compliance */
/* ============================= */

.evidence-card {
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.evidence-card .evidence-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.evidence-card .evidence-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.evidence-status.approved {
  background: var(--success-light);
  color: var(--success-dark);
}

.evidence-status.pending {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.evidence-status.rejected {
  background: var(--error-light);
  color: var(--error-dark);
}

/* ============================= */
/* Print Styles */
/* ============================= */

@media print {
  .document-container {
    padding: 0;
    max-width: 100%;
  }

  .document-container h1,
  .document-container h2,
  .document-container h3 {
    page-break-after: avoid;
  }

  .cmmc-table,
  .evidence-card {
    page-break-inside: avoid;
  }

  .cover-page {
    page-break-after: always;
  }

  @page {
    margin: 1in;
    size: letter;
  }

  @page :first {
    margin: 0;
  }
}

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

@media (max-width: 768px) {
  .document-container {
    padding: 20px;
  }

  .document-container h1 {
    font-size: 2rem;
  }

  .document-container h2 {
    font-size: 1.5rem;
  }

  .cmmc-table {
    font-size: 0.875rem;
  }

  .cmmc-table th,
  .cmmc-table td {
    padding: 8px;
  }
}

/* ============================= */
/* Animations & Transitions */
/* ============================= */

.document-container a {
  color: var(--primary-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

.document-container a:hover {
  color: var(--text-secondary);
  text-decoration: underline;
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}

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

/* ============================= */
/* Lexical Editor Styles */
/* ============================= */

.editor-paragraph {
  margin: 0 0 1em 0;
  line-height: 1.6;
}

.editor-heading-h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem 0;
  line-height: 1.2;
}

.editor-heading-h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem 0;
  line-height: 1.3;
}

.editor-heading-h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
  line-height: 1.4;
}

.editor-text-bold {
  font-weight: bold;
}

.editor-text-italic {
  font-style: italic;
}

.editor-text-underlined {
  text-decoration: underline;
}

.editor-list-ul {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  list-style-type: disc;
}

.editor-list-ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  list-style-type: decimal;
}

.editor-listitem {
  margin: 0.25rem 0;
}

.editor-nested-listitem {
  list-style-type: circle;
}

/* ============================= */
/* Lexical Table Styles */
/* ============================= */

/* Table styling for Lexical editor */
.editor-table {
  border-collapse: collapse;
  border: 1px solid var(--divider);
  margin: 1rem 0;
  width: 100%;
  background: white;
}

.editor-table-cell {
  border: 1px solid var(--divider);
  padding: 8px 12px;
  position: relative;
  vertical-align: top;
  min-height: 20px;
  min-width: 50px;
}

.editor-table-cell-header {
  background: var(--bg-paper);
  font-weight: 600;
  border: 1px solid var(--divider);
  padding: 8px 12px;
}

/* Table cell selection styling */
.editor-table-cell:focus {
  outline: 2px solid var(--primary-main);
  outline-offset: -2px;
}

/* Table row styling */
.editor-table-row {
  border: none;
}

/* Hover effects for table editing */
.editor-table-cell:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.editor-table-cell-header:hover {
  background-color: rgba(0, 0, 0, 0.05);
}