/* Copyright (c) 2026 Eleftherios Notas and The XIOM Authors
   SPDX-License-Identifier: MIT OR Apache-2.0 */
/* ================================================================
   XIOM Playground Layout -- v0.49.9
   Flex-based responsive layout: sidebar | narrative | editor+output
   ================================================================ */

/* ---- Lessons Screen ---- */
.lessons-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.lessons-screen .header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ---- Sidebar (lesson list) ---- */
/* width is set in theme.css at 280px */

/* ---- Narrative Panel (lesson content) ---- */
/* Sits between sidebar and editor in a vertical split */
.lessons-screen .narrative-panel {
  width: 370px;
  min-width: 320px;
  max-width: 420px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
}

/* ---- Editor Section (editor + output + status) ---- */
.editor-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

.editor-container {
  flex: 1;
  min-height: 0;
  background: var(--panel);
}

.lessons-screen .output-panel {
  height: 34%;
  min-height: 140px;
  flex-shrink: 0;
}

/* ---- Stdlib Persistent Panel (right of editor) ---- */
.stdlib-panel {
  width: 340px;
  min-width: 280px;
  max-width: 420px;
  flex-shrink: 0;
  background: var(--panel);
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease;
}
.stdlib-panel.hidden { display: none; }
.stdlib-panel.pinned { border-left-color: var(--indigo); }

/* Mobile: persistent panels become full-screen overlays. This must live in the
   file that loads last (layout.css) so it beats the base width above. */
@media (max-width: 768px) {
  .stdlib-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
  }
}

/* ---- Sidebar Hidden ---- */
.lessons-screen.sidebar-hidden .sidebar { display: none; }
.lessons-screen.sidebar-hidden .narrative-panel { display: none; }
.lessons-screen.sidebar-hidden .resize-handle { display: none; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .lessons-screen .narrative-panel {
    width: 280px;
    min-width: 240px;
    max-width: 320px;
  }
}

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

  .sidebar {
    width: 100% !important;
    max-height: 140px;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .lessons-screen .narrative-panel {
    width: 100% !important;
    min-width: 0;
    max-width: none;
    max-height: 30%;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .resize-handle {
    display: none !important;
  }

  .editor-section {
    flex: 1;
    min-height: 50vh;
  }

  .header {
    padding: 8px 12px;
    flex-wrap: wrap;
  }

  .header-site-link {
    display: none;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 6px 8px;
    gap: 4px;
  }

  .header-actions {
    gap: 2px;
    flex-wrap: wrap;
  }

  .lesson-header-title {
    display: none;
  }

  .back-btn {
    font-size: 13px;
    padding: 6px;
  }
}
