/* ========== Docs Shared Styles ========== */
/* Shared stylesheet for all documentation pages */
/* Uses CSS variables from style.css */

/* ========== Layout ========== */
.doc-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 80px;
  min-height: calc(100vh - 200px);
}

.doc-sidebar {
  position: sticky;
  top: 90px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.doc-sidebar-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.doc-sidebar-nav {
  list-style: none;
}

.doc-sidebar-nav li {
  margin-bottom: 4px;
}

.doc-sidebar-nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text-gray);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: var(--transition);
  text-decoration: none;
}

.doc-sidebar-nav a:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.doc-sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  color: var(--primary-color);
  font-weight: 600;
}

.doc-sidebar-nav .nav-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  padding: 16px 12px 6px;
}

.doc-content {
  max-width: 800px;
  min-width: 0;
}

/* ========== Breadcrumb ========== */
.doc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.doc-breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.doc-breadcrumb a:hover {
  text-decoration: underline;
}

.doc-breadcrumb .separator {
  color: var(--border-color);
}

.doc-breadcrumb .current {
  color: var(--text-dark);
  font-weight: 500;
}

/* ========== Page Header ========== */
.doc-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.doc-header h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  line-height: 1.2;
}

.doc-header .doc-subtitle {
  font-size: 18px;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 0;
}

/* ========== Content Styles ========== */
.doc-content h2 {
  color: var(--primary-color);
  margin-top: 48px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
  font-size: 28px;
}

.doc-content h3 {
  color: var(--text-dark);
  margin-top: 32px;
  margin-bottom: 16px;
  font-size: 22px;
}

.doc-content h4 {
  color: var(--text-dark);
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 18px;
}

.doc-content p {
  color: var(--text-gray);
  line-height: 1.8;
  margin-bottom: 16px;
}

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

.doc-content li {
  margin: 8px 0;
  color: var(--text-gray);
  line-height: 1.6;
}

.doc-content code {
  background: var(--bg-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: var(--primary-color);
  border: 1px solid var(--border-color);
}

.doc-content strong {
  color: var(--text-dark);
}

/* ========== Info Boxes ========== */
.doc-info-box {
  background: var(--bg-light);
  padding: 24px;
  border-radius: 8px;
  margin: 24px 0;
  border-left: 4px solid var(--primary-color);
}

.doc-info-box.tip {
  border-left-color: #48bb78;
  background: #f0fff4;
}

.doc-info-box.warning {
  border-left-color: #f6ad55;
  background: #fffaf0;
}

.doc-info-box.important {
  border-left-color: #f56565;
  background: #fff5f5;
}

.doc-info-box p:last-child {
  margin-bottom: 0;
}

/* ========== Code Blocks ========== */
.doc-code-block {
  background: #2d3748;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 16px 0;
}

.doc-code-block .comment { color: #68d391; }
.doc-code-block .keyword { color: #63b3ed; }
.doc-code-block .string { color: #fbd38d; }
.doc-code-block .number { color: #fc8181; }

.doc-code-label {
  display: block;
  color: #a0aec0;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========== Step Lists ========== */
.doc-steps {
  counter-reset: step-counter;
  list-style: none;
  padding: 0;
  margin: 24px 0;
}

.doc-steps li {
  counter-increment: step-counter;
  position: relative;
  padding: 20px 20px 20px 60px;
  margin-bottom: 16px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.doc-steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: 16px;
  top: 18px;
  width: 32px;
  height: 32px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* ========== Phase Cards (for SDD workflow) ========== */
.doc-phase-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  margin: 24px 0;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.doc-phase-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-lg);
}

.doc-phase-number {
  display: inline-block;
  background: var(--gradient-primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  text-align: center;
  line-height: 36px;
  font-weight: 700;
  font-size: 16px;
  margin-right: 12px;
  vertical-align: middle;
}

.doc-phase-title {
  display: inline;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
  vertical-align: middle;
}

.doc-phase-card p {
  margin-top: 12px;
}

/* ========== Feature Grid ========== */
.doc-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 24px 0;
}

.doc-feature-item {
  background: white;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.doc-feature-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.doc-feature-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

/* ========== Tables ========== */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.doc-content th {
  background: var(--primary-color);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}

.doc-content td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.doc-content tr:last-child td {
  border-bottom: none;
}

.doc-content tr:hover td {
  background: var(--bg-light);
}

/* ========== Next Steps / Navigation Links ========== */
.doc-next-steps {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--border-color);
}

.doc-next-steps h3 {
  margin-top: 0;
}

.doc-nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.doc-nav-card {
  display: block;
  padding: 20px;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  transition: var(--transition);
}

.doc-nav-card:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.doc-nav-card .card-title {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.doc-nav-card .card-desc {
  color: var(--text-light);
  font-size: 14px;
}

/* ========== i18n Block Toggle ========== */
.i18n-block {
  display: none;
}

.i18n-block.active {
  display: block;
}

/* ========== FAQ Styles ========== */
.faq-section {
  margin-bottom: 32px;
}

.faq-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-question {
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.faq-question:hover {
  background: var(--bg-light);
  color: var(--primary-color);
}

.faq-question::after {
  content: '+';
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  transition: var(--transition);
}

.faq-item.open .faq-question::after {
  content: '-';
}

.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-answer {
  padding: 0 20px 20px;
  max-height: 500px;
}

.faq-answer p {
  margin: 8px 0;
}

/* ========== Case Study Styles ========== */
.case-study-hero {
  background: var(--gradient-primary);
  color: white;
  padding: 60px 24px;
  text-align: center;
  margin: -32px -24px 40px;
  border-radius: 0 0 12px 12px;
}

.case-study-hero h1 {
  color: white;
  font-size: 42px;
}

.case-study-hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
}

.case-study-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.case-study-stat {
  background: white;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.case-study-stat .stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
}

.case-study-stat .stat-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

.case-study-timeline {
  position: relative;
  padding-left: 40px;
  margin: 32px 0;
}

.case-study-timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
  padding: 20px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 24px;
  width: 12px;
  height: 12px;
  background: var(--primary-color);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: var(--shadow);
}

/* ========== Example Page Shared Styles ========== */
/* (Extracted from inline styles in example pages) */
.example-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px;
}

.example-header {
  background: var(--gradient-primary);
  color: white;
  padding: 60px 24px;
  text-align: center;
  margin: -40px -24px 40px;
}

.example-header h1 {
  color: white;
}

.example-header p {
  color: rgba(255, 255, 255, 0.9);
}

.example-metadata {
  background: var(--bg-light);
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 32px;
  border-left: 4px solid var(--primary-color);
}

.example-content {
  line-height: 1.8;
}

.example-content h2 {
  color: var(--primary-color);
  margin-top: 48px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.example-content h3 {
  color: var(--text-gray);
  margin-top: 32px;
  margin-bottom: 16px;
}

.example-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.example-content th {
  background: var(--primary-color);
  color: white;
  padding: 12px;
  text-align: left;
  font-weight: 600;
}

.example-content td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.example-content tr:last-child td {
  border-bottom: none;
}

.example-content ul {
  margin: 16px 0;
  padding-left: 24px;
}

.example-content li {
  margin: 8px 0;
  color: var(--text-gray);
}

/* Glossary */
.glossary-term {
  font-weight: 600;
  color: var(--primary-color);
}

/* Requirement ID badge */
.req-id {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  margin-right: 8px;
}

/* User Stories */
.user-story {
  background: white;
  padding: 24px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.user-story-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 12px;
}

.user-story-content {
  color: var(--text-gray);
  margin: 8px 0;
  line-height: 1.6;
}

.user-story-label {
  display: inline-block;
  font-weight: 600;
  color: var(--text-dark);
  min-width: 80px;
}

.acceptance-criteria {
  background: var(--bg-light);
  padding: 16px;
  border-radius: 6px;
  margin-top: 16px;
}

.acceptance-criteria ul {
  margin: 8px 0;
  padding-left: 24px;
}

.acceptance-criteria li {
  margin: 6px 0;
  color: var(--text-gray);
}

/* Task Checklist */
.task-checklist {
  background: white;
  padding: 24px;
  border-radius: 8px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.task-checklist h4 {
  color: var(--text-dark);
  margin-bottom: 16px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.task-item:hover {
  background: var(--bg-light);
}

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

.task-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.task-checkbox.done {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.task-id {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--primary-color);
  min-width: 80px;
}

.task-desc {
  flex: 1;
  color: var(--text-gray);
}

.task-desc.done {
  text-decoration: line-through;
  color: #a0aec0;
}

/* Scope Box */
.scope-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 32px 0;
}

.scope-section {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scope-section h4 {
  margin-bottom: 16px;
  color: var(--text-dark);
}

.scope-section.included {
  border-left: 4px solid #48bb78;
}

.scope-section.excluded {
  border-left: 4px solid #f56565;
}

.scope-section ul {
  margin: 0;
  padding-left: 20px;
}

.scope-section li {
  margin: 8px 0;
  color: var(--text-gray);
}

/* Architecture Diagram */
.architecture-diagram {
  background: #2d3748;
  color: #e2e8f0;
  padding: 24px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 24px 0;
}

/* API Documentation */
.api-endpoint {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  margin: 24px 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.api-endpoint-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-light);
  border-bottom: 2px solid var(--border-color);
}

.api-method {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
}

.api-method.get { background: #48bb78; color: white; }
.api-method.post { background: var(--primary-color); color: white; }
.api-method.put { background: #f6ad55; color: white; }
.api-method.delete { background: #f56565; color: white; }

.api-path {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.api-endpoint-body {
  padding: 24px;
}

.api-description {
  color: var(--text-gray);
  margin-bottom: 20px;
  line-height: 1.6;
}

.api-auth {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.api-auth.required { background: #fed7d7; color: #c53030; }
.api-auth.not-required { background: #c6f6d5; color: #22543d; }

.code-block {
  background: #2d3748;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

.code-block-label {
  display: block;
  color: #a0aec0;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.code-block .comment { color: #68d391; }
.code-block .key { color: #63b3ed; }
.code-block .string { color: #fbd38d; }
.code-block .number { color: #fc8181; }
.code-block .boolean { color: #b794f4; }

.response-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  margin: 8px 0;
}

.response-status.success { background: #c6f6d5; color: #22543d; }
.response-status.error { background: #fed7d7; color: #c53030; }

.api-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.api-table th {
  background: var(--bg-light);
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  border-bottom: 2px solid var(--border-color);
}

.api-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-gray);
}

.api-table tr:last-child td {
  border-bottom: none;
}

.param-name {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--primary-color);
}

.param-type {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--text-light);
}

.param-required {
  color: #f56565;
  font-size: 12px;
  font-weight: 600;
}

.curl-example {
  background: #1a202c;
  color: #68d391;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.8;
  overflow-x: auto;
  margin: 16px 0;
}

/* Back Link */
.back-link {
  display: inline-block;
  margin-top: 48px;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

/* ========== PlantUML Diagrams ========== */
.plantuml-diagram {
  text-align: center;
  margin: 24px 0;
  padding: 24px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.plantuml-diagram img {
  max-width: 100%;
  height: auto;
}

.plantuml-diagram .diagram-caption {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 12px;
  font-style: italic;
}

/* Showcase: source + rendered diagram side by side */
.plantuml-showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
  align-items: start;
}

.plantuml-showcase .showcase-source {
  background: #2d3748;
  color: #e2e8f0;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}

.plantuml-showcase .showcase-source .source-label {
  display: block;
  color: #a0aec0;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.plantuml-showcase .showcase-render {
  text-align: center;
  padding: 20px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.plantuml-showcase .showcase-render img {
  max-width: 100%;
  height: auto;
}

.plantuml-showcase .showcase-render .diagram-caption {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 12px;
  font-style: italic;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .doc-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px;
  }

  .doc-sidebar {
    position: static;
    max-height: none;
    margin-bottom: 32px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
  }

  .doc-header h1 {
    font-size: 28px;
  }

  .doc-content h2 {
    font-size: 24px;
  }

  .scope-box {
    grid-template-columns: 1fr;
  }

  .doc-nav-cards {
    grid-template-columns: 1fr;
  }

  .doc-feature-grid {
    grid-template-columns: 1fr;
  }

  .plantuml-showcase {
    grid-template-columns: 1fr;
  }

  .case-study-hero h1 {
    font-size: 28px;
  }

  .example-page {
    padding: 20px 16px;
  }

  .example-header {
    padding: 40px 16px;
    margin: -20px -16px 32px;
  }
}

@media (max-width: 480px) {
  .doc-header h1 {
    font-size: 24px;
  }

  .case-study-stats {
    grid-template-columns: 1fr 1fr;
  }
}
