/* ==========================================================================
   Terminal for Vibe Coders - Terminal & Course Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Terminal Panel - Window Chrome
   -------------------------------------------------------------------------- */

.terminal-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #2b2b3d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
}

.terminal-titlebar__dots {
  display: flex;
  gap: 6px;
}

.terminal-titlebar__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-titlebar__dot--red { background: #ff5f57; }
.terminal-titlebar__dot--yellow { background: #febc2e; }
.terminal-titlebar__dot--green { background: #28c840; }

.terminal-titlebar__title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  color: #8888a0;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Terminal Container
   -------------------------------------------------------------------------- */

.terminal {
  background: #1e1e2e;
  font-family: 'Source Code Pro', 'Courier New', monospace;
  font-size: 14px;
  color: #cdd6f4;
  padding: 1rem 1.25rem;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  position: relative;
  line-height: 1.6;
  border-radius: 0;
  box-shadow: none;
  flex: 1;
}

.terminal:focus-within {
  box-shadow: none;
}

.terminal__output {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal__line {
  min-height: 1.2em;
}

.terminal__input-line {
  display: flex;
  align-items: center;
}

.terminal__prompt {
  color: #34d399;
  font-weight: bold;
  white-space: nowrap;
  margin-right: 0.5ch;
}

.terminal__input {
  background: none;
  border: none;
  color: #cdd6f4;
  font: inherit;
  flex: 1;
  outline: none;
  caret-color: #34d399;
  padding: 0;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Output Coloring
   -------------------------------------------------------------------------- */

.terminal__dir {
  color: #89b4fa;
  font-weight: bold;
}

.terminal__exec {
  color: #34d399;
}

.terminal__error {
  color: #f38ba8;
}

.terminal__warning {
  color: #fab387;
}

.terminal__info {
  color: #89dceb;
}

.terminal__muted {
  color: #6c7086;
}

/* --------------------------------------------------------------------------
   Dangerous Command Warnings
   -------------------------------------------------------------------------- */

.terminal__danger {
  color: #f38ba8;
  background: rgba(243, 139, 168, 0.1);
  padding: 0.5rem;
  border-left: 3px solid #f38ba8;
  margin: 0.25rem 0;
  display: block;
  white-space: pre-wrap;
}

.terminal__safety-note {
  color: #fab387;
  background: rgba(250, 179, 135, 0.1);
  padding: 0.5rem;
  border-left: 3px solid #fab387;
  margin: 0.25rem 0;
  display: block;
  white-space: pre-wrap;
}

/* --------------------------------------------------------------------------
   Linux Lesson Layout Modes
   -------------------------------------------------------------------------- */

.linux-lesson--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.linux-lesson--split .lesson-content {
  overflow-y: auto;
  max-height: calc(100vh - 120px);
  padding-right: 1rem;
}

.linux-lesson--split .terminal-panel {
  position: sticky;
  top: 80px;
  height: calc(100vh - 120px);
}

.linux-lesson--split .terminal-panel .terminal {
  max-height: none;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.linux-lesson--full .terminal-panel {
  margin-top: 2rem;
  max-width: 800px;
}

.linux-lesson--full .terminal-panel .terminal {
  min-height: 350px;
  max-height: 500px;
}

/* --------------------------------------------------------------------------
   Layout Toggle Button
   -------------------------------------------------------------------------- */

.layout-toggle {
  background: #f3f4f6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #374151;
  transition: background-color 0.15s;
}

.layout-toggle:hover {
  background: #e5e7eb;
}

/* --------------------------------------------------------------------------
   Challenge Card
   -------------------------------------------------------------------------- */

.challenge-card {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.challenge-card__title {
  font-weight: 600;
  color: #047857;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.challenge-card__description {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: #374151;
  line-height: 1.5;
}

.challenge-card__actions {
  display: flex;
  gap: 0.75rem;
}

.challenge-card--complete {
  border-color: #059669;
}

.challenge-card--complete .challenge-card__title {
  color: #059669;
}

.challenge-card__success {
  color: #22c55e;
  font-weight: 600;
  margin-top: 0.75rem;
}

.challenge-card__fail {
  color: #dc2626;
  font-weight: 500;
  margin-top: 0.75rem;
}

.challenge-card__hint {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border-left: 3px solid #d1d5db;
}

.challenge-card__feedback {
  min-height: 0;
}

.challenge-card__hints {
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Sandbox Layout
   -------------------------------------------------------------------------- */

.sandbox-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  padding: 1rem;
}

.sandbox-terminal .terminal-panel {
  height: calc(100vh - 140px);
}

.sandbox-terminal .terminal-panel .terminal {
  max-height: none;
  min-height: 0;
  flex: 1;
}

.cheat-sheet {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: 0.85rem;
}

.cheat-sheet h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: #111827;
}

.cheat-sheet__group {
  margin-bottom: 1.25rem;
}

.cheat-sheet__group h4 {
  color: #059669;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.cheat-sheet__cmd {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  gap: 0.5rem;
}

.cheat-sheet__cmd code {
  font-size: 0.8rem;
  background: #f3f4f6;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: 'Source Code Pro', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.cheat-sheet__cmd span {
  color: #6b7280;
  font-size: 0.78rem;
  text-align: right;
}

.cheat-sheet--hidden {
  display: none;
}

.cheat-sheet-toggle {
  background: #f3f4f6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: #374151;
  transition: background-color 0.15s;
}

.cheat-sheet-toggle:hover {
  background: #e5e7eb;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .linux-lesson--split {
    grid-template-columns: 1fr;
  }

  .linux-lesson--split .lesson-content {
    max-height: none;
    padding-right: 0;
  }

  .linux-lesson--split .terminal-panel {
    position: static;
    height: auto;
  }

  .linux-lesson--split .terminal-panel .terminal {
    max-height: 400px;
    min-height: 300px;
    flex: unset;
  }

  .sandbox-layout {
    grid-template-columns: 1fr;
  }

  .cheat-sheet {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .terminal {
    font-size: 13px;
    padding: 0.75rem;
    min-height: 250px;
    max-height: 400px;
  }

  .sandbox-terminal .terminal-panel .terminal {
    max-height: calc(100vh - 180px);
    min-height: 300px;
    flex: unset;
  }

  .layout-toggle {
    display: none;
  }

  .terminal-titlebar__title {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Quiz Button Styles (used in challenges and quizzes)
   -------------------------------------------------------------------------- */

.quiz-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s, opacity 0.15s;
}

.quiz-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quiz-btn--primary {
  background: #059669;
  color: #fff;
}

.quiz-btn--primary:hover:not(:disabled) {
  background: #047857;
}

.quiz-btn--secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.quiz-btn--secondary:hover:not(:disabled) {
  background: #e5e7eb;
}
