/* ===== Easy Deep Learning - Shared Styles ===== */
/* White theme with documentation-style layout */

font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

:root {
  --sidebar-width: 180px;
  --toc-width: 200px;
  --content-max: 800px;
  --bg-primary: #ffffff;
  --bg-sidebar: #f8fafc;
  --bg-card: rgba(0,0,0,0.03);
  --border-subtle: rgba(0,0,0,0.08);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-indigo: #6366f1;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
}

* { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
code, .mono { font-family: 'JetBrains Mono', monospace; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  line-height: 1.7;
}

/* ===== Layout: Sidebar + Content + TOC ===== */
.page-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  background: #f8fafc;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  z-index: 40;
  padding: 20px 0;
  transition: none;
  box-sizing: border-box;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
  text-decoration: none;
  color: var(--text-primary);
}

.sidebar-logo:hover { color: var(--accent-indigo); }

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 15px;
  font-weight: 700;
}

.sidebar-logo-text span {
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Stage Groups */
.sidebar-stage {
  margin-bottom: 8px;
}

.sidebar-stage-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-stage-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Chapter Links */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 20px 5px 28px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(0,0,0,0.03);
}

.sidebar-link.active {
  color: var(--accent-indigo);
  border-left-color: var(--accent-indigo);
  background: rgba(99,102,241,0.06);
  font-weight: 500;
}

.sidebar-link-num {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 16px;
}

.sidebar-link.active .sidebar-link-num {
  color: var(--accent-indigo);
}

/* Main Content Area */
.main-area {
  display: flex;
  justify-content: center;
  min-width: 0;
  overflow-x: hidden;
}

.content-wrapper {
  width: 100%;
  max-width: calc(var(--content-max) + var(--toc-width) + 80px);
  position: relative;
  padding: 0 24px;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.content-body {
  min-width: 0;
  max-width: var(--content-max);
  padding-top: 32px;
  padding-bottom: 80px;
}

/* Right TOC */
.toc {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  right: 20px;
  width: var(--toc-width);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  z-index: 20;
  opacity: 0.35;
  transition: all 0.3s ease;
}

.toc:hover {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-color: var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  opacity: 1;
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc-link {
  display: block;
  padding: 3px 0 3px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 1px solid var(--border-subtle);
  transition: all 0.15s;
  line-height: 1.5;
}

.toc-link:hover {
  color: var(--text-secondary);
  border-left-color: var(--text-secondary);
}

.toc-link.active {
  color: var(--accent-indigo);
  border-left-color: var(--accent-indigo);
}

/* ===== Typography ===== */
.content-body h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.content-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 40px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.content-body h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.content-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 28px 0 12px;
  color: var(--text-primary);
}

.content-body p {
  margin: 10px 0;
  color: var(--text-secondary);
  line-height: 1.75;
}

.content-body ul, .content-body ol {
  padding-left: 1.25em;
  margin: 10px 0;
  color: var(--text-secondary);
}

.content-body li {
  margin: 4px 0;
  line-height: 1.7;
}

.content-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content-body code {
  font-size: 0.9em;
  background: rgba(99,102,241,0.08);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent-indigo);
}

.content-body pre {
  background: #f1f5f9;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  position: relative;
}

.content-body pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 13px;
}

/* ===== Copy Button ===== */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 2;
  font-family: 'Inter', system-ui, sans-serif;
}

.copy-btn:hover {
  color: var(--accent-indigo);
  border-color: var(--accent-indigo);
  background: rgba(255,255,255,0.95);
}

.copy-btn.copied {
  color: #16a34a;
  border-color: #16a34a;
  background: rgba(34,197,94,0.08);
}

/* ===== Gradient Text ===== */
.gradient-text {
  background: linear-gradient(135deg, #818cf8, #c084fc, #f472b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== Nav Blur ===== */
.nav-blur {
  backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.85);
}

/* ===== Glass Card ===== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

/* ===== Excel Table ===== */
.excel-table { border-collapse: collapse; font-size: 14px; width: 100%; }
.excel-table th {
  background: #eef2ff;
  color: #4338ca;
  font-weight: 600;
  padding: 10px 14px;
  border: 1px solid rgba(99,102,241,0.2);
  text-align: center;
}
.excel-table td {
  padding: 10px 14px;
  border: 1px solid rgba(0,0,0,0.06);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.excel-table .highlight { background: rgba(99,102,241,0.12) !important; color: #4338ca; font-weight: 600; }
.excel-table .result { background: rgba(34,197,94,0.1) !important; color: #16a34a; font-weight: 600; }
.excel-table .formula { background: rgba(251,191,36,0.08) !important; color: #b45309; }
.excel-table .input-cell { background: rgba(99,102,241,0.04); }
.excel-table .row-header { background: rgba(99,102,241,0.06); color: #6366f1; font-weight: 500; text-align: left; padding-left: 16px; }
.excel-table .step-header { background: linear-gradient(135deg, #eef2ff, #ede9fe); color: #4338ca; font-weight: 700; font-size: 13px; letter-spacing: 0.5px; }

/* ===== Editable Cells ===== */
.editable { cursor: pointer; position: relative; }
.editable:hover { outline: 2px solid rgba(99,102,241,0.4); outline-offset: -2px; }
.editable:focus { outline: 2px solid #6366f1; outline-offset: -2px; background: rgba(99,102,241,0.08) !important; }

/* ===== Step Cards ===== */
.step-card { position: relative; padding-left: 60px; }
.step-card::before {
  content: '';
  position: absolute;
  left: 23px;
  top: 50px;
  bottom: -20px;
  width: 2px;
  background: rgba(99,102,241,0.15);
}
.step-card:last-child::before { display: none; }

.step-num {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
  box-shadow: 0 0 20px rgba(99,102,241,0.2);
}

/* ===== Interactive Slider ===== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(99,102,241,0.15);
  height: 6px;
  border-radius: 3px;
  outline: none;
  width: 100%;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(99,102,241,0.3);
}

/* ===== Quiz ===== */
.quiz-option.selected-correct { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); }
.quiz-option.selected-wrong { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); }
.quiz-option.disabled { pointer-events: none; opacity: 0.6; }
.radio-circle { transition: all 0.2s; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-s1 { background: rgba(99,102,241,0.1); color: #4338ca; }
.badge-s2 { background: rgba(139,92,246,0.1); color: #6d28d9; }
.badge-s3 { background: rgba(236,72,153,0.1); color: #be185d; }

/* ===== Callout Boxes ===== */
.callout {
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
}

.callout-tip {
  background: rgba(34,197,94,0.06);
  border-left: 3px solid #22c55e;
  color: #15803d;
}

.callout-info {
  background: rgba(99,102,241,0.06);
  border-left: 3px solid #6366f1;
  color: #4338ca;
}

.callout-warn {
  background: rgba(251,191,36,0.06);
  border-left: 3px solid #f59e0b;
  color: #a16207;
}

/* ===== Architecture Flow (shared by multiple pages) ===== */
.arch-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.arch-block {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  min-width: 60px;
}

.arch-arrow {
  color: #6366f1;
  font-size: 18px;
}

/* ===== Page Navigation (Prev/Next) ===== */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  margin-top: 48px;
  border-top: 1px solid var(--border-subtle);
}

.page-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

.page-nav a:hover { color: var(--text-primary); }

.page-nav .btn-next {
  padding: 8px 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 100px;
  color: white;
  font-weight: 600;
  font-size: 13px;
}

.page-nav .btn-next:hover { opacity: 0.9; color: white; }

/* ===== Footer ===== */
.page-footer {
  text-align: center;
  padding: 24px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 82px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.3s;
  z-index: 60;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ===== Reading Progress ===== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
  z-index: 100;
  transition: width 0.1s;
  width: 0%;
}

/* ===== Mobile Responsive ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 49;
}

/* ===== Language Switch ===== */
.sidebar-lang-switch {
  padding: 16px 20px;
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
}

.lang-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', system-ui, sans-serif;
}

.lang-switch-btn:hover {
  background: rgba(99,102,241,0.08);
  color: var(--accent-indigo);
  border-color: rgba(99,102,241,0.3);
}

@media (min-width: 1001px) {
  :root { --sidebar-width: 220px; }
}

@media (min-width: 1201px) {
  :root { --sidebar-width: 260px; }

  .content-wrapper {
    display: flex;
    justify-content: center;
    max-width: calc(var(--content-max) + 40px);
    margin: 0 auto;
    padding: 0 24px;
  }

  .toc {
    display: block;
  }
}

@media (max-width: 1200px) {
  .toc { display: none; }
  .content-wrapper {
    max-width: var(--content-max);
    display: flex;
    justify-content: center;
    padding: 0 24px;
  }
  .content-body {
    padding-left: 0;
  }
}

@media (max-width: 1000px) {
  :root { --sidebar-width: 160px; }
  .sidebar-link { padding-left: 16px; font-size: 11px; }
  .sidebar-logo { padding: 0 12px 16px; }
  .sidebar-logo-text { font-size: 13px; }
  .sidebar-stage-label { padding-left: 12px; font-size: 11px; }
  .sidebar-lang-switch { padding: 12px 12px; }
  .lang-switch-btn { font-size: 11px; padding: 6px 10px; }
}

@media (max-width: 768px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    transform: translateX(-100%);
    z-index: 50;
    position: fixed;
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .content-wrapper {
    padding: 0 16px;
    display: flex;
    justify-content: center;
  }
}

/* ===== Feedback System ===== */
.feedback-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  z-index: 100;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(99,102,241,0.5);
}

.feedback-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.feedback-modal.active {
  display: flex;
}

.feedback-modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.feedback-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
}

.feedback-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

.feedback-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.feedback-close:hover {
  color: #475569;
}

.feedback-form {
  padding: 24px;
}

.feedback-field {
  margin-bottom: 20px;
}

.feedback-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}

.feedback-field .required {
  color: #ef4444;
}

.feedback-field select,
.feedback-field input,
.feedback-field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.feedback-field select:focus,
.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.feedback-field textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.feedback-submit {
  padding: 12px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.feedback-cancel {
  padding: 12px 24px;
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.feedback-cancel:hover {
  background: #e2e8f0;
}

.feedback-success {
  padding: 40px 24px;
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.feedback-success p {
  font-size: 18px;
  color: #1e293b;
  margin: 0 0 24px;
}

.feedback-close-btn {
  padding: 12px 24px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.feedback-close-btn:hover {
  background: #4f46e5;
}

@media (max-width: 768px) {
  .feedback-btn {
    bottom: 88px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  .back-to-top {
    bottom: 146px;
    right: 16px;
    width: 44px;
    height: 44px;
  }

  .feedback-modal-content {
    width: 95%;
    margin: 20px;
  }
}
