/* Enhanced Professional Documentation Styling */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --text-color: #2c3e50;
  --text-muted: #7f8c8d;
  --bg-color: #ffffff;
  --bg-light: #f8f9fa;
  --bg-code: #f4f4f4;
  --border-color: #dee2e6;
  --border-radius: 8px;
  --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "Monaco", "Inconsolata", "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 1em;
  line-height: 1.3;
  color: var(--primary-color);
}

h1 {
  font-size: 2.5em;
  margin-top: 0;
  padding-bottom: 0.5em;
  border-bottom: 3px solid var(--secondary-color);
  text-align: center;
  margin-bottom: 2em;
}

h2 {
  font-size: 2em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid var(--border-color);
  margin-top: 3em;
}

h3 {
  font-size: 1.5em;
  color: var(--secondary-color);
}

h4 {
  font-size: 1.25em;
  margin-top: 1.5em;
}

p {
  margin-bottom: 1.2em;
  text-align: justify;
}

/* Links */
a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Code styling */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background-color: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--accent-color);
  white-space: pre-wrap;
}

pre {
  background-color: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5em;
  overflow-x: auto;
  margin: 1.5em 0;
  box-shadow: var(--box-shadow);
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9em;
  line-height: 1.4;
  color: var(--text-color);
}

/* Code block language labels */
pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  background: var(--text-muted);
  color: white;
  padding: 0.3em 0.8em;
  font-size: 0.8em;
  border-bottom-left-radius: var(--border-radius);
  text-transform: uppercase;
  font-weight: 600;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2em 0;
  background-color: var(--bg-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

thead {
  background-color: var(--primary-color);
  color: white;
}

th, td {
  padding: 1em;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9em;
  letter-spacing: 0.5px;
}

tbody tr:hover {
  background-color: var(--bg-light);
}

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

/* Lists */
ul, ol {
  margin: 1em 0;
  padding-left: 2em;
}

li {
  margin-bottom: 0.5em;
}

ul ul, ol ol {
  margin: 0.5em 0;
}

/* Blockquotes */
blockquote {
  margin: 2em 0;
  padding: 1em 1.5em;
  background-color: var(--bg-light);
  border-left: 4px solid var(--secondary-color);
  border-radius: var(--border-radius);
  font-style: italic;
  box-shadow: var(--box-shadow);
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.3em 0.8em;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 20px;
  margin-right: 0.5em;
}

.badge-success {
  background-color: var(--success-color);
  color: white;
}

.badge-warning {
  background-color: var(--warning-color);
  color: white;
}

.badge-error {
  background-color: var(--accent-color);
  color: white;
}

/* Alert boxes */
.alert {
  padding: 1em 1.5em;
  margin: 1.5em 0;
  border-radius: var(--border-radius);
  border-left: 4px solid;
  box-shadow: var(--box-shadow);
}

.alert-info {
  background-color: #e3f2fd;
  border-color: var(--secondary-color);
  color: #1565c0;
}

.alert-warning {
  background-color: #fff3e0;
  border-color: var(--warning-color);
  color: #e65100;
}

.alert-success {
  background-color: #e8f5e8;
  border-color: var(--success-color);
  color: #2e7d32;
}

/* Navigation TOC */
.toc {
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5em;
  margin: 2em 0;
}

.toc h3 {
  margin-top: 0;
  color: var(--primary-color);
}

.toc ul {
  list-style: none;
  padding-left: 0;
}

.toc li {
  margin-bottom: 0.3em;
}

.toc a {
  display: block;
  padding: 0.3em 0;
  border-bottom: 1px dotted var(--border-color);
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 20px 15px;
  }
  
  h1 {
    font-size: 2em;
  }
  
  h2 {
    font-size: 1.7em;
  }
  
  table {
    font-size: 0.9em;
  }
  
  th, td {
    padding: 0.8em 0.5em;
  }
  
  pre {
    padding: 1em;
    font-size: 0.8em;
  }
}

/* Print styles */
@media print {
  @page {
    margin: 2cm 2.5cm;
    size: A4;
  }
  
  body {
    font-size: 11pt;
    line-height: 1.4;
    color: black;
    margin: 0;
    padding: 0;
  }
  
  .document {
    box-shadow: none;
    border-radius: 0;
  }
  
  .header {
    background: none !important;
    color: black !important;
    padding: 1cm 0 0.5cm 0;
    margin-bottom: 1cm;
    border-bottom: 2pt solid #2c3e50;
    page-break-after: avoid;
  }
  
  .header h1 {
    color: black !important;
    text-shadow: none !important;
    font-size: 18pt;
    margin: 0;
  }
  
  .header .subtitle {
    color: #666 !important;
    font-size: 12pt;
    margin-top: 0.3cm;
  }
  
  .container {
    max-width: none;
    margin: 0;
    padding: 0 1cm;
    width: 100%;
  }
  
  .toc {
    background: none;
    border: 1pt solid #ccc;
    padding: 0.5cm;
    margin: 0.5cm 0 1cm 0;
    page-break-after: avoid;
  }
  
  .toc h3 {
    margin-top: 0;
    font-size: 12pt;
    color: black;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    color: black;
    margin-top: 1cm;
    margin-bottom: 0.5cm;
  }
  
  h1 {
    font-size: 16pt;
    border-bottom: 1pt solid #2c3e50;
    padding-bottom: 0.3cm;
  }
  
  h2 {
    font-size: 14pt;
    border-bottom: 0.5pt solid #ccc;
    padding-bottom: 0.2cm;
  }
  
  h3 {
    font-size: 13pt;
  }
  
  h4 {
    font-size: 12pt;
  }
  
  p {
    margin-bottom: 0.4cm;
    text-align: left;
    orphans: 3;
    widows: 3;
  }
  
  pre {
    background: #f8f8f8 !important;
    border: 1pt solid #ccc;
    padding: 0.3cm;
    margin: 0.3cm 0;
    page-break-inside: avoid;
    font-size: 9pt;
    line-height: 1.3;
    overflow: hidden;
  }
  
  pre code {
    color: black;
    font-size: 9pt;
  }
  
  code {
    background: #f0f0f0 !important;
    border: 0.5pt solid #ccc;
    padding: 0.1cm 0.2cm;
    font-size: 9pt;
    color: black;
  }
  
  blockquote {
    background: #f8f8f8 !important;
    border-left: 3pt solid #2c3e50;
    padding: 0.3cm 0.5cm;
    margin: 0.3cm 0;
    page-break-inside: avoid;
  }
  
  table {
    page-break-inside: avoid;
    border-collapse: collapse;
    width: 100%;
    margin: 0.5cm 0;
    font-size: 10pt;
  }
  
  thead {
    background: #f0f0f0 !important;
    color: black !important;
  }
  
  th, td {
    border: 0.5pt solid #ccc;
    padding: 0.2cm 0.3cm;
    text-align: left;
  }
  
  th {
    font-weight: bold;
    background: #f0f0f0 !important;
  }
  
  tbody tr:hover {
    background: none !important;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }
  
  .no-print {
    display: none;
  }
  
  /* Ensure proper spacing between sections */
  h2 {
    margin-top: 1.5cm;
  }
  
  /* Avoid page breaks in the middle of important content */
  .alert, .badge {
    page-break-inside: avoid;
    background: #f8f8f8 !important;
    color: black !important;
    border: 0.5pt solid #ccc;
  }
}

/* Syntax highlighting for different languages */
.sourceCode .kw { color: #007020; font-weight: bold; } /* Keyword */
.sourceCode .dt { color: #902000; } /* DataType */
.sourceCode .dv { color: #40a070; } /* DecVal */
.sourceCode .bn { color: #40a070; } /* BaseN */
.sourceCode .fl { color: #40a070; } /* Float */
.sourceCode .ch { color: #4070a0; } /* Char */
.sourceCode .st { color: #4070a0; } /* String */
.sourceCode .co { color: #60a0b0; font-style: italic; } /* Comment */
.sourceCode .ot { color: #007020; } /* Other */
.sourceCode .al { color: #ff0000; font-weight: bold; } /* Alert */
.sourceCode .fu { color: #06287e; } /* Function */
.sourceCode .er { color: #ff0000; font-weight: bold; } /* Error */

/* Header with logo area */
.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 2em 0;
  margin-bottom: 2em;
  text-align: center;
}

.header h1 {
  color: white;
  border: none;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header .subtitle {
  font-size: 1.2em;
  opacity: 0.9;
  margin-top: 0.5em;
}

/* Enhanced layout wrapper */
.document {
  background: white;
  box-shadow: var(--box-shadow);
  border-radius: var(--border-radius);
  overflow: hidden;
}
