/* ============================================================================
   MONTESSORI GLOSSARY API - Documentation Stylesheet
   ============================================================================ */

/* Root Variables */
:root {
  --bg: #FAFAF7;
  --bg-card: #FFFFFF;
  --text: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-tertiary: #7a7a9a;
  --accent: #2A9D8F;
  --accent-light: #E8F5F3;
  --accent-dark: #1E7A6E;
  --code-bg: #1e1e2e;
  --code-text: #e0e0e0;
  --border: #e8e6e1;
  --warning-bg: #FFF8E7;
  --warning-border: #F5C542;
  --info-bg: #E8F4FD;
  --info-border: #5BA4CF;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ============================================================================
   GLOBAL STYLES
   ============================================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text);
}

h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 1rem 0;
  color: var(--text);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 1.5rem 0 0.75rem 0;
  color: var(--text);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem 0;
  color: var(--text);
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
}

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

/* ============================================================================
   LAYOUT
   ============================================================================ */

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

#sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 2rem 0;
}

.main-content {
  flex: 1;
  max-width: 900px;
  padding: 3rem;
  width: 100%;
}

/* ============================================================================
   SIDEBAR STYLING
   ============================================================================ */

.sidebar-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  padding: 0 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: 0 1.25rem 0.4rem 1.25rem;
  display: block;
}

.nav-link {
  display: block;
  padding: 6px 16px 6px 20px;
  border-left: 3px solid transparent;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  cursor: pointer;
  margin: 1px 0.5rem;
  border-radius: 0 6px 6px 0;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent);
  background-color: var(--accent-light);
}

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

/* ============================================================================
   HERO SECTION
   ============================================================================ */

.hero {
  padding: 3rem 0 2rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero h1 {
  margin-bottom: 0.5rem;
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-tertiary);
  font-weight: 400;
  margin-bottom: 1.25rem;
}

.base-url-pill {
  display: inline-block;
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  margin-top: 1rem;
  word-break: break-all;
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
  display: inline-block;
  background-color: var(--accent-light);
  color: var(--accent-dark);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
}

.badge.get {
  --accent-light: #E3F2FD;
  --accent-dark: #1565C0;
}

.badge.post {
  --accent-light: #F3E5F5;
  --accent-dark: #6A1B9A;
}

.badge.put {
  --accent-light: #FFF3E0;
  --accent-dark: #E65100;
}

.badge.delete {
  --accent-light: #FFEBEE;
  --accent-dark: #C62828;
}

/* ============================================================================
   ENDPOINT CARDS
   ============================================================================ */

section.endpoint {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

section.endpoint:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--accent);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text);
  flex: 1;
  word-break: break-all;
}

/* ============================================================================
   CODE BLOCKS
   ============================================================================ */

.code-block {
  position: relative;
  margin: 1.5rem 0;
}

.code-block pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem 1.5rem;
  padding-right: 4rem; /* space for copy button */
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
  font-family: var(--font-mono);
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Syntax highlighting */
.kw {
  color: #c678dd;
}

.str {
  color: #98c379;
}

.cm {
  color: #5c6370;
}

.fn {
  color: #61afef;
}

/* ============================================================================
   COPY BUTTON
   ============================================================================ */

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #aaa;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.copy-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.copy-btn.copied {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ============================================================================
   TABLES
   ============================================================================ */

.fields-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.fields-table th {
  text-align: left;
  padding: 8px 12px;
  background-color: var(--bg);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
}

.fields-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

.fields-table td code {
  background-color: var(--accent-light);
  color: var(--accent-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--font-mono);
}

/* ============================================================================
   CALLOUT BOXES
   ============================================================================ */

.callout-warning,
.callout-info {
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-left: 4px solid;
}

.callout-warning {
  background-color: var(--warning-bg);
  border-left-color: var(--warning-border);
}

.callout-info {
  background-color: var(--info-bg);
  border-left-color: var(--info-border);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.callout-content {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ============================================================================
   TRY-IT PANELS
   ============================================================================ */

.try-it-panel {
  background-color: var(--accent-light);
  border: 1px solid rgba(42, 157, 143, 0.2);
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.try-it-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
}

.try-it-form {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
}

.try-it-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg-card);
  outline: none;
  transition: border-color 0.2s ease;
}

.try-it-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

.try-it-btn {
  background-color: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.try-it-btn:hover:not(:disabled) {
  background-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 157, 143, 0.3);
}

.try-it-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.try-it-result {
  min-height: 0;
  transition: all 0.3s ease;
}

.try-it-result.has-content {
  min-height: 60px;
}

.try-it-result pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  font-family: var(--font-mono);
}

.try-it-result .result-card {
  background-color: var(--bg-card);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.try-it-result .result-term-name {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--text);
}

.try-it-result .result-definition {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.try-it-result .result-source {
  color: var(--text-tertiary);
  font-size: 0.85em;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ============================================================================
   FLOW DIAGRAM
   ============================================================================ */

.flow-diagram {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 0.75rem 0.5rem;
  padding: 2rem 0;
  margin: 2rem 0;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.5rem;
}

.flow-step p {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.flow-step code {
  font-size: 0.8rem;
}

.flow-step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.flow-step-label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.flow-step-task {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.flow-arrow {
  font-size: 1.5rem;
  color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1rem;
  flex-shrink: 0;
}

/* ============================================================================
   VOCAB STRUCTURE DIAGRAM
   ============================================================================ */

.vocab-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 2rem;
  margin: 2rem 0;
}

.vocab-node {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-weight: 600;
  position: relative;
  font-size: 14px;
  color: var(--text);
}

.vocab-node.center {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
  font-size: 1.1em;
  padding: 14px 24px;
}

.vocab-connector {
  width: 2px;
  height: 20px;
  background-color: var(--border);
}

.vocab-row {
  display: flex;
  gap: 20px;
  align-items: center;
}

.vocab-relation-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ============================================================================
   IMPORTANT NOTES BOX
   ============================================================================ */

#important-notes .notes-box {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 14px;
  text-align: center;
}

footer a {
  color: var(--text-tertiary);
  text-decoration: underline;
}

footer a:hover {
  color: var(--accent);
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================================
   CORS BANNER
   ============================================================================ */

.cors-banner {
  background-color: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-secondary);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.inline-code {
  background-color: var(--accent-light);
  color: var(--accent-dark);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

section[id] {
  scroll-margin-top: 2rem;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  #sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  }

  #sidebar.open {
    transform: translateX(280px);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  #menu-toggle {
    display: block;
  }

  .mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 998;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    align-items: center;
    gap: 12px;
    height: 60px;
  }

  .mobile-header h1 {
    font-size: 1.25rem;
    flex: 1;
    margin: 0;
  }

  .main-content {
    padding: 1.5rem;
    padding-top: 70px;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero {
    margin-bottom: 2rem;
  }

  section.endpoint {
    padding: 1.25rem;
  }

  .endpoint-header {
    flex-wrap: wrap;
  }

  .try-it-form {
    flex-direction: column;
  }

  .try-it-btn {
    width: 100%;
  }

  .flow-diagram {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .flow-arrow {
    margin: 0;
    padding: 0;
    transform: rotate(90deg);
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .code-block pre {
    font-size: 13px;
  }

  .copy-btn {
    padding: 3px 8px;
    font-size: 11px;
  }

  section[id] {
    scroll-margin-top: 70px;
  }
}

/* menu-toggle base styles now handled via .menu-toggle class below */

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

/* ============================================================================
   MISSING STYLES — sidebar-header, nav-list, content-section, etc.
   ============================================================================ */

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.nav-list {
  list-style: none;
  padding: 0.75rem 0;
  margin: 0;
}

.nav-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-list > li > .nav-link {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.content-section {
  margin-bottom: 2.5rem;
}

.hero-content {
  max-width: 600px;
}

.footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
}

.hero-meta {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

.hero-meta a {
  color: var(--accent);
  text-decoration: none;
}

.hero-meta a:hover {
  text-decoration: underline;
}

.project-credit {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.project-credit p {
  margin: 0;
}

.project-credit a {
  color: var(--accent-dark);
  font-weight: 500;
  text-decoration: none;
}

.project-credit a:hover {
  text-decoration: underline;
}

/* Mobile header & hamburger — hidden on desktop, shown on mobile */
@media (min-width: 769px) {
  .mobile-header {
    display: none;
  }
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 40px;
  height: 40px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

.mobile-header-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

/* Vocab hierarchy diagram */
.vocab-hierarchy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 1.5rem 0;
}

.hierarchy-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.hierarchy-box h4 {
  margin: 0 0 0.5rem;
  color: var(--accent-dark);
}

.hierarchy-box p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.hierarchy-example {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 0.85rem !important;
}

.hierarchy-arrow {
  font-size: 1.5rem;
  color: var(--accent);
  padding: 0.25rem 0;
}

.vocab-relations {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.relation-box {
  flex: 1;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.relation-box h4 {
  margin: 0 0 0.5rem;
  color: var(--accent-dark);
}

.relation-box p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.relation-description {
  color: var(--text-tertiary);
  font-size: 0.85rem !important;
}

/* Callout variants used in HTML */
.callout {
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.callout.alert {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
}

.callout.warning {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
}

.callout.note {
  background: var(--info-bg);
  border-left: 4px solid var(--info-border);
}

.callout h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.callout ol {
  margin: 0;
  padding-left: 1.25rem;
}

.callout ol li {
  margin-bottom: 0.75rem;
}

.callout ol li:last-child {
  margin-bottom: 0;
}

/* Error message */
.error-message {
  color: #e74c3c;
  background: #fdf0ef;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #f5c6cb;
  font-size: 0.9rem;
}

/* Suggestion list */
.suggestion-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.suggestion-list li {
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 0.85rem;
  text-align: center;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

footer p {
  margin: 0.25rem 0;
}

/* ============================================================================
   RESPONSIVE — MOBILE
   ============================================================================ */

@media (max-width: 768px) {
  .vocab-relations {
    flex-direction: column;
  }
}

@media print {
  #sidebar,
  #menu-toggle,
  .mobile-header,
  .try-it-panel,
  .copy-btn {
    display: none !important;
  }

  .main-content {
    max-width: 100%;
    padding: 0;
  }

  section.endpoint {
    page-break-inside: avoid;
  }

  body {
    background-color: white;
  }
}
