/* ====================================================
   Linux Lab — стилистика эмулятора (тёмный терминал,
   панели уроков в Claude-стиле)
   ==================================================== */

:root {
  --term-bg: #1f1d1a;
  --term-fg: #e8e6e1;
  --term-dim: #8a8983;
  --term-green: #a4c267;
  --term-blue: #79c0ff;
  --term-yellow: #d2a8ff;
  --term-orange: #ff9b73;
  --term-red: #f88379;
  --term-cyan: #56d4dd;
}

.lab-container {
  display: grid;
  grid-template-columns: 260px 1fr 420px;
  height: calc(100vh - 52px - 28px);
  min-height: 600px;
  background: var(--bg);
}

/* ===== SIDEBAR ===== */
.lab-sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lab-sidebar-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.lab-sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
}
.lab-progress { font-size: 12px; color: var(--text-muted); }
.lab-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
#progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.lab-progress-text {
  font-family: var(--font-mono);
  font-size: 11px;
}

.lab-lessons-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.lesson-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px 20px;
  cursor: pointer;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  color: var(--text);
  transition: background 0.1s;
}
.lesson-item:hover { background: var(--bg-elevated); }
.lesson-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.lesson-item .lesson-check {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}
.lesson-item.completed .lesson-check {
  color: var(--success);
}
.lesson-item.completed .lesson-check::after { content: "✓"; }
.lesson-item:not(.completed):not(.active) .lesson-check::after { content: "○"; }
.lesson-item.active:not(.completed) .lesson-check::after { content: "▸"; color: var(--accent); }

.lab-sidebar-actions {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.lab-sidebar-actions .btn { font-size: 12px; padding: 6px 10px; flex: 1; justify-content: center; }

/* ===== TERMINAL PANE ===== */
.lab-terminal-pane {
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.lab-terminal-header {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  align-items: center;
  padding: 10px 14px;
  background: #15130f;
  border-bottom: 1px solid #2a2724;
  user-select: none;
  gap: 10px;
}
.lab-terminal-dots { display: flex; gap: 6px; }
.lab-terminal-dots .dot {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
}
.lab-terminal-dots .red { background: #ff5f57; }
.lab-terminal-dots .yellow { background: #febc2e; }
.lab-terminal-dots .green { background: #28c840; }

.lab-terminal-title {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--term-dim);
}
.lab-terminal-meta {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--term-dim);
}

.lab-terminal {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--term-fg);
  cursor: text;
}
.lab-terminal:focus { outline: none; }

#output {
  white-space: pre-wrap;
  word-wrap: break-word;
}
#output .line { display: block; }

.lab-prompt-line {
  display: block;
  line-height: 1.5;
}
#prompt {
  margin-right: 6px;
  white-space: nowrap;
  user-select: none;
}
#input-area {
  display: inline;
  outline: none;
  word-break: break-all;
  caret-color: transparent;
}
.lab-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--term-fg);
  vertical-align: text-bottom;
  margin-left: 0;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ANSI colors */
.ansi-red    { color: var(--term-red); }
.ansi-green  { color: var(--term-green); }
.ansi-yellow { color: #e6c44d; }
.ansi-blue   { color: var(--term-blue); }
.ansi-mag    { color: var(--term-yellow); }
.ansi-cyan   { color: var(--term-cyan); }
.ansi-orange { color: var(--term-orange); }
.ansi-dim    { color: var(--term-dim); }
.ansi-bold   { font-weight: 700; }
.ansi-error  { color: var(--term-red); }
.ansi-success { color: var(--term-green); }
.dir         { color: var(--term-blue); font-weight: 600; }
.exec        { color: var(--term-green); font-weight: 600; }
.symlink     { color: var(--term-cyan); }

/* ===== LESSON PANE ===== */
.lab-lesson-pane {
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--border);
}
.lab-lesson-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 26px 40px;
  line-height: 1.65;
  font-size: 14.5px;
}
.lab-lesson-welcome { color: var(--text); }
.lab-lesson-welcome h2 { font-size: 20px; margin-bottom: 8px; margin-top: 0; }
.lab-lesson-welcome h4 { margin-top: 18px; font-size: 14px; }
.lab-lesson-welcome p { font-size: 14px; }
.lab-lesson-welcome ul, .lab-lesson-welcome ol { font-size: 14px; }

.lab-lesson-content h3 {
  font-size: 19px;
  margin-top: 4px;
  margin-bottom: 14px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.lab-lesson-content h4 {
  font-size: 14.5px;
  margin-top: 22px;
  margin-bottom: 6px;
  color: var(--text);
}
.lab-lesson-content p { margin-bottom: 10px; font-size: 14px; }
.lab-lesson-content code {
  font-size: 12.5px;
  padding: 1px 5px;
}
.lab-lesson-content pre {
  font-size: 12.5px;
  padding: 12px 14px;
  margin: 10px 0 14px;
}
.lab-lesson-content ul, .lab-lesson-content ol { font-size: 14px; padding-left: 22px; }
.lab-lesson-content li { margin-bottom: 4px; }

/* Callouts в уроке (компактнее) */
.lab-lesson-content .callout {
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 13.5px;
}
.lab-lesson-content .callout-label { font-size: 11.5px; margin-bottom: 4px; }
.lab-lesson-content .callout p { font-size: 13.5px; margin-bottom: 4px; }
.lab-lesson-content .callout p:last-child { margin-bottom: 0; }

/* Задание */
.lab-task {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 14px 16px;
  margin: 14px 0;
}
.lab-task-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 13.5px;
  color: var(--text);
}
.lab-task-title::before {
  content: "○";
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
}
.lab-task.done {
  background: var(--success-soft);
  border-color: var(--success);
}
.lab-task.done .lab-task-title::before {
  content: "✓";
  color: var(--success);
  font-weight: 700;
}
.lab-task-status {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.lab-task.done .lab-task-status { color: var(--success); }
.lab-task.done .lab-task-status::before { content: "Выполнено! "; font-weight: 600; }

/* Flash notification */
.lab-flash {
  position: fixed;
  top: 70px;
  right: 24px;
  background: var(--success);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s, fadeOut 0.3s 1.8s forwards;
}
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(120%); }
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 1280px) {
  .lab-container { grid-template-columns: 220px 1fr 360px; }
}
@media (max-width: 1024px) {
  .lab-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
  }
  .lab-sidebar { max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
  .lab-terminal-pane { min-height: 400px; }
  .lab-lesson-pane { border-left: none; border-top: 1px solid var(--border); max-height: 400px; }
}
