/* AGISystem2 Documentation Styles */

:root {
  --primary-color: #1976d2;
  --secondary-color: #424242;
  --accent-color: #ff5722;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --background: #fafafa;
  --surface: #ffffff;
  --text-primary: #212121;
  --text-secondary: #757575;
  --border-color: #e0e0e0;
  --code-bg: #f5f5f5;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background);
  margin: 0;
  padding: 0;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 40px;
  background: var(--surface);
  min-height: 100vh;
}

/* Navigation Header */
.nav-header {
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 15px;
  margin-bottom: 30px;
}

.nav-header h1 {
  color: var(--primary-color);
  margin: 0 0 10px 0;
  font-size: 1.8em;
}

.nav-header small {
  display: block;
  color: var(--text-secondary);
  margin-top: 5px;
}

.nav-header small a {
  color: var(--primary-color);
  text-decoration: none;
  margin: 0 8px;
}

.nav-header small a:hover {
  text-decoration: underline;
}

/* Typography */
h1 { font-size: 2em; color: var(--primary-color); margin-top: 0; }
h2 { font-size: 1.5em; color: var(--secondary-color); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-top: 40px; }
h3 { font-size: 1.25em; color: var(--text-primary); margin-top: 30px; }
h4 { font-size: 1.1em; color: var(--text-secondary); }

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

/* Section styles */
.section-intro {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  border-left: 4px solid var(--primary-color);
}

.section-intro p {
  margin: 0;
  font-size: 1.05em;
}

/* Grid layouts */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.section-card {
  background: var(--surface);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
}

.section-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.section-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.section-card h3 a {
  text-decoration: none;
}

.section-card p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.95em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

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

th {
  background: var(--code-bg);
  font-weight: 600;
  color: var(--secondary-color);
}

tr:hover {
  background: #fafafa;
}

.matrix-table td:first-child {
  width: 200px;
  background: var(--code-bg);
  font-weight: 500;
}

/* Code */
pre {
  background: var(--code-bg);
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

code {
  font-family: 'Consolas', 'Monaco', 'Fira Code', monospace;
  font-size: 0.9em;
}

pre code {
  display: block;
  line-height: 1.5;
}

:not(pre) > code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Lists */
ul, ol {
  padding-left: 25px;
}

li {
  margin: 8px 0;
}

/* SVG diagrams */
.diagram-container {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
  overflow-x: auto;
}

.diagram-container svg {
  max-width: 100%;
  height: auto;
}

.diagram-title {
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 15px;
  font-size: 1.1em;
}

/* Badges and tags */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 500;
}

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

/* Requirement IDs */
.req-id {
  font-family: monospace;
  font-weight: 600;
  color: var(--primary-color);
  background: #e3f2fd;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Alerts */
.alert {
  padding: 15px 20px;
  border-radius: 8px;
  margin: 20px 0;
  border-left: 4px solid;
}

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

.alert-success {
  background: #e8f5e9;
  border-color: var(--success-color);
}

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

.alert-error {
  background: #ffebee;
  border-color: var(--error-color);
}

/* Footer */
.footer-nav {
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9em;
}

/* Breadcrumb */
.breadcrumb {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin-bottom: 20px;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary-color);
}

/* Traceability matrix */
.trace-matrix {
  font-size: 0.85em;
}

.trace-matrix th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.trace-matrix td.covered {
  background: #c8e6c9;
  text-align: center;
}

.trace-matrix td.partial {
  background: #fff9c4;
  text-align: center;
}

.trace-matrix td.not-covered {
  background: #ffcdd2;
  text-align: center;
}

/* Print styles */
@media print {
  .page {
    max-width: none;
    padding: 0;
  }

  .nav-header small:first-of-type {
    display: none;
  }

  .section-card {
    break-inside: avoid;
  }

  pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }
}

/* Fluid typography - scales smoothly between mobile and desktop */
html {
  font-size: clamp(16px, 2.5vw, 18px);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .page {
    padding: 20px 25px;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  html {
    font-size: 17px; /* Slightly larger base for mobile readability */
  }

  body {
    line-height: 1.7; /* More line spacing on mobile */
  }

  .page {
    padding: 16px;
  }

  /* Larger headings on mobile for better hierarchy */
  h1 { font-size: 1.75em; }
  h2 { font-size: 1.35em; margin-top: 30px; }
  h3 { font-size: 1.15em; margin-top: 25px; }

  .nav-header h1 {
    font-size: 1.5em;
  }

  /* Navigation menu - compact horizontal scroll on mobile */
  .nav-header small:first-of-type {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 0.9em;
    line-height: 1.6;
    margin: 10px 0;
  }

  .nav-header small:first-of-type a {
    display: inline-block;
    padding: 6px 10px;
    background: #e3f2fd;
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
  }

  .nav-header small:first-of-type a:hover {
    background: #bbdefb;
  }

  /* Subtitle line */
  .nav-header small:last-of-type {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 8px;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }

  .section-intro {
    padding: 16px;
    font-size: 1em;
  }

  .section-intro p {
    font-size: 1em;
  }

  /* Tables - horizontal scroll instead of tiny text */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 0.95em;
    min-width: 500px; /* Force scroll instead of squishing */
  }

  th, td {
    padding: 10px 12px;
  }

  /* Code blocks */
  pre {
    padding: 15px;
    font-size: 0.9em;
  }

  code {
    font-size: 0.95em;
  }

  /* Lists with better spacing */
  ul, ol {
    padding-left: 20px;
  }

  li {
    margin: 10px 0;
  }

  /* Alerts */
  .alert {
    padding: 14px 16px;
    font-size: 0.95em;
  }

  /* Footer */
  .footer-nav {
    font-size: 0.95em;
    margin-top: 40px;
  }
}

/* Responsive - Small phones */
@media (max-width: 480px) {
  html {
    font-size: 18px; /* Even larger for small screens */
  }

  .page {
    padding: 14px;
  }

  h1 { font-size: 1.6em; }
  h2 { font-size: 1.25em; }
  h3 { font-size: 1.1em; }

  .nav-header h1 {
    font-size: 1.4em;
  }

  /* Stack navigation links vertically on very small screens */
  .nav-header small a {
    display: block;
    margin: 6px 0;
  }

  pre {
    padding: 12px;
    border-radius: 6px;
  }

  .section-card {
    padding: 18px;
  }

  /* Badges */
  .badge {
    font-size: 0.85em;
    padding: 4px 8px;
  }
}
