/* ============================================
   Telecom Billing App - Training Docs Theme
   Enterprise visual system with dark mode
   ============================================ */

:root {
  /* Primary palette */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Neutral palette */
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  /* Semantic */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  /* Surfaces */
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Text */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);

  /* Layout */
  --sidebar-w: 280px;
  --utility-h: 56px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --lh: 1.7;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --border-light: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
  --success-bg: #064e3b;
  --warning-bg: #78350f;
  --danger-bg: #7f1d1d;
  --info-bg: #1e3a8a;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--utility-h) + 24px); }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); text-decoration: underline; }
img { max-width: 100%; height: auto; border-radius: var(--radius); }
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-tertiary); color: var(--text-secondary);
  border: 1px solid var(--border); min-width: 20px;
}
code {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-tertiary); padding: 2px 6px;
  border-radius: 4px; color: var(--text);
}
pre {
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; overflow-x: auto;
  margin: 16px 0;
}
pre code { background: none; padding: 0; border-radius: 0; }
h1, h2, h3, h4, h5, h6 { line-height: 1.3; color: var(--text); font-weight: 600; }
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
h2 { font-size: 1.5rem; font-weight: 700; margin-top: 40px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.15rem; font-weight: 600; margin-top: 28px; margin-bottom: 8px; }
h4 { font-size: 1rem; font-weight: 600; margin-top: 20px; margin-bottom: 6px; }
p { margin-bottom: 12px; color: var(--text-secondary); }
ul, ol { margin: 8px 0 16px 20px; color: var(--text-secondary); }
li { margin-bottom: 4px; }
li > ul, li > ol { margin: 4px 0 4px 20px; }
table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text); background: var(--bg-secondary); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
td { color: var(--text-secondary); }
tr:hover td { background: var(--surface-hover); }
blockquote {
  border-left: 3px solid var(--primary-500);
  background: var(--info-bg);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}
blockquote p { margin: 0; }

/* Utility Bar */
.utility-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--utility-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.utility-inner {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 100%; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-icon { color: var(--primary-500); display: flex; }
.brand-text { font-weight: 700; font-size: 16px; }
.brand-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 20px;
  background: var(--primary-100); color: var(--primary-700);
}
.search-container {
  flex: 1; max-width: 420px; position: relative;
  display: none;
}
@media (min-width: 768px) { .search-container { display: block; } }
.search-container .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-tertiary); pointer-events: none;
}
.search-container input {
  width: 100%; height: 36px; padding: 0 36px 0 38px;
  border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg-secondary); color: var(--text);
  font-size: 14px; font-family: var(--font);
  outline: none; transition: all 0.2s;
}
.search-container input:focus { border-color: var(--primary-400); background: var(--bg); box-shadow: 0 0 0 3px var(--primary-100); }
.search-container input::placeholder { color: var(--text-tertiary); }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.utility-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-tertiary); color: var(--text); }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }
.mobile-menu-btn { display: flex; }
@media (min-width: 1024px) { .mobile-menu-btn { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 14px; font-weight: 500;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: all 0.15s; text-decoration: none;
  background: var(--surface); color: var(--text);
}
.btn:hover { text-decoration: none; background: var(--bg-tertiary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--primary-600); color: white; border-color: var(--primary-600); }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; border-color: #059669; }

/* Layout */
.layout { display: flex; padding-top: var(--utility-h); min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed; top: var(--utility-h); left: 0; bottom: 0;
  width: var(--sidebar-w); overflow-y: auto;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  padding: 16px 0; z-index: 50;
  transition: transform 0.3s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar-section { margin-bottom: 4px; }
.sidebar-header {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); padding: 8px 20px 4px;
}
.sidebar-links { list-style: none; margin: 0; }
.sidebar-links li { margin: 0; }
.sidebar-links a {
  display: block; padding: 6px 20px; font-size: 14px; font-weight: 400;
  color: var(--text-secondary); text-decoration: none;
  border-left: 2px solid transparent; transition: all 0.1s;
}
.sidebar-links a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.sidebar-links a.active {
  color: var(--primary-600); font-weight: 500;
  background: var(--primary-50); border-left-color: var(--primary-500);
}
[data-theme="dark"] .sidebar-links a.active { background: rgba(59,130,246,0.1); }

/* Mobile sidebar */
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .layout { flex-direction: column; }
}

/* Main Content */
.content {
  flex: 1; margin-left: var(--sidebar-w);
  max-width: 960px; padding: 32px 48px 80px;
}
@media (max-width: 1023px) {
  .content { margin-left: 0; padding: 24px 20px 60px; }
}
@media (max-width: 480px) {
  .content { padding: 16px 16px 60px; }
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-tertiary); margin-bottom: 24px;
}
.crumb { color: var(--text-tertiary); }
.crumb.current { color: var(--text-secondary); font-weight: 500; }
.crumb-sep { color: var(--border); }

/* Page Content Styles */
.page-section { margin-bottom: 48px; }
.page-section:last-child { margin-bottom: 0; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-900), var(--primary-700));
  color: white; padding: 48px; border-radius: var(--radius-lg);
  margin-bottom: 32px;
}
.hero h1 { color: white; font-size: 2.2rem; margin-bottom: 12px; }
.hero p { color: rgba(255,255,255,0.85); font-size: 1.05rem; max-width: 600px; }
.hero-stats { display: flex; gap: 32px; margin-top: 24px; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 1.8rem; font-weight: 800; color: white; }
.hero-stat-label { font-size: 13px; color: rgba(255,255,255,0.7); }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 16px 0; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: all 0.15s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-300); }
.card-icon { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: var(--primary-50); color: var(--primary-600); margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 1rem; }
.card p { font-size: 13px; margin: 0; color: var(--text-tertiary); }
.card .card-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 8px; }

/* Tags & Badges */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; padding: 2px 10px;
  border-radius: 20px; background: var(--bg-tertiary); color: var(--text-secondary);
}
.tag-admin { background: #fef3c7; color: #92400e; }
.tag-manager { background: #dbeafe; color: #1e40af; }
.tag-viewonly { background: #d1fae5; color: #065f46; }
.tag-success { background: var(--success-bg); color: #065f46; }
.tag-warning { background: var(--warning-bg); color: #78350f; }
.tag-danger { background: var(--danger-bg); color: #991b1b; }

/* Steps / Procedure */
.step-list { counter-reset: step; margin: 16px 0; }
.step-item {
  counter-increment: step;
  position: relative; padding: 16px 16px 16px 52px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px;
}
.step-item::before {
  content: counter(step);
  position: absolute; left: 14px; top: 14px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-600); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.step-item h4 { margin: 0 0 4px; font-size: 14px; }
.step-item p { margin: 0; font-size: 13px; }
.step-item .step-note { margin-top: 8px; font-size: 12px; color: var(--text-tertiary); padding: 8px; background: var(--bg-secondary); border-radius: 4px; }

/* Info boxes */
.info-box { padding: 12px 16px; border-radius: var(--radius); margin: 12px 0; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.info-box svg { flex-shrink: 0; margin-top: 2px; }
.info-tip { background: var(--info-bg); border: 1px solid var(--primary-200); color: var(--primary-800); }
.info-warning { background: var(--warning-bg); border: 1px solid #fde68a; color: #92400e; }
.info-danger { background: var(--danger-bg); border: 1px solid #fecaca; color: #991b1b; }
.info-success { background: var(--success-bg); border: 1px solid #a7f3d0; color: #065f46; }

/* Academy Course */
.course-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px;
}
.course-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.course-card .course-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.course-card .course-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 12px; }
.course-lessons { list-style: none; margin: 0; }
.course-lessons li {
  padding: 8px 12px; border-left: 2px solid var(--border);
  margin: 0 0 4px; font-size: 14px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.course-lessons li::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary-400); flex-shrink: 0;
}
.course-lessons li.completed { border-left-color: var(--success); }
.course-lessons li.completed::before { background: var(--success); }

/* Quiz */
.quiz-question { margin-bottom: 20px; }
.quiz-question p { font-weight: 500; margin-bottom: 8px; color: var(--text); }
.quiz-options { list-style: none; margin: 0; }
.quiz-options li {
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px;
  cursor: pointer; transition: all 0.15s; font-size: 14px;
}
.quiz-options li:hover { border-color: var(--primary-400); background: var(--primary-50); }
.quiz-options li.selected { border-color: var(--primary-500); background: var(--primary-50); }
.quiz-options li.correct { border-color: var(--success); background: var(--success-bg); }
.quiz-options li.incorrect { border-color: var(--danger); background: var(--danger-bg); }
.quiz-result { margin-top: 12px; padding: 12px; border-radius: var(--radius); font-size: 14px; display: none; }
.quiz-result.show { display: block; }

/* Accordion */
.accordion { margin: 12px 0; }
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.accordion-header {
  padding: 12px 16px; background: var(--bg-secondary);
  cursor: pointer; font-weight: 500; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
  user-select: none;
}
.accordion-header:hover { background: var(--surface-hover); }
.accordion-header::after {
  content: '+'; font-size: 18px; color: var(--text-tertiary);
  transition: transform 0.2s;
}
.accordion-item.open .accordion-header::after { content: '−'; }
.accordion-body { padding: 0 16px; max-height: 0; overflow: hidden; transition: all 0.2s; }
.accordion-item.open .accordion-body { padding: 12px 16px; max-height: 500px; }

/* Tabs */
.tabs { margin: 16px 0; }
.tab-nav { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  padding: 10px 20px; font-size: 14px; font-weight: 500;
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s; font-family: var(--font);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary-600); border-bottom-color: var(--primary-600); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Progress bar */
.progress-bar {
  height: 6px; background: var(--bg-tertiary); border-radius: 3px;
  overflow: hidden; margin: 8px 0;
}
.progress-fill {
  height: 100%; background: var(--primary-500);
  border-radius: 3px; transition: width 0.5s ease;
}

/* Screenshot placeholder */
.screenshot {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin: 16px 0; position: relative;
  background: var(--bg-secondary);
}
.screenshot img { display: block; width: 100%; }
.screenshot-caption {
  padding: 8px 12px; font-size: 13px; color: var(--text-tertiary);
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  text-align: center;
}

/* Data model diagram */
.schema-diagram {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin: 16px 0;
  overflow-x: auto;
}
.schema-table {
  display: inline-block; vertical-align: top;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 8px; min-width: 200px;
}
.schema-table-header {
  padding: 8px 12px; font-weight: 600; font-size: 13px;
  background: var(--primary-600); color: white;
  border-radius: var(--radius) var(--radius) 0 0;
}
.schema-table-row {
  padding: 4px 12px; font-size: 12px; border-bottom: 1px solid var(--border-light);
  display: flex; justify-content: space-between; gap: 12px;
}
.schema-table-row:last-child { border-bottom: none; }
.schema-table-row .field-name { font-weight: 500; color: var(--text); }
.schema-table-row .field-type { color: var(--text-tertiary); font-family: var(--mono); font-size: 11px; }
.schema-table-row .field-key { color: var(--warning); font-size: 10px; }

/* Footer */
.content-footer {
  margin-top: 64px; padding-top: 24px;
  border-top: 1px solid var(--border);
}
.footer-inner p { font-size: 13px; color: var(--text-tertiary); margin: 0; }
.footer-meta { margin-top: 4px; font-size: 12px; }

/* Search Overlay */
.search-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
.search-overlay.open { display: flex; }
.search-modal {
  width: 100%; max-width: 600px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.search-modal-header input {
  flex: 1; border: none; outline: none; font-size: 16px;
  font-family: var(--font); color: var(--text);
  background: transparent;
}
.search-results { max-height: 400px; overflow-y: auto; padding: 8px 0; }
.search-hint { padding: 20px; text-align: center; color: var(--text-tertiary); font-size: 14px; }
.search-result-item {
  padding: 10px 20px; cursor: pointer; display: block;
  text-decoration: none; color: var(--text);
}
.search-result-item:hover { background: var(--surface-hover); }
.search-result-item .result-title { font-weight: 500; font-size: 14px; }
.search-result-item .result-path { font-size: 12px; color: var(--text-tertiary); }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 520px; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 20px; }

/* Print */
@media print {
  .utility-bar, .sidebar, .search-overlay, .modal-overlay { display: none; }
  .content { margin-left: 0; padding: 0; }
  .hero { background: none !important; color: black !important; padding: 24px; border: 1px solid #ddd; }
  .hero h1 { color: black !important; }
  .hero p { color: #555 !important; }
  .hero-stat-value { color: black !important; }
  .card-grid { break-inside: avoid; }
  .step-item { break-inside: avoid; }
  a { color: black !important; }
  pre { white-space: pre-wrap; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-enter { animation: fadeIn 0.3s ease; }

/* Responsive table */
@media (max-width: 640px) {
  table { display: block; overflow-x: auto; }
  .hero { padding: 24px; }
  .hero h1 { font-size: 1.5rem; }
  .card-grid { grid-template-columns: 1fr; }
}