/* Project Layout - Split pane: instructions left, editor right */

/* Sidebar toggle for project pages */
.project-layout .book-container {
  display: flex;
  position: relative;
}

.project-layout .book-sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  width: 280px;
  height: calc(100vh - var(--header-height));
  z-index: 30;
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.project-layout .book-sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-toggle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 31;
  background: var(--ink-light);
  border: 1px solid var(--ink-border);
  border-left: none;
  border-radius: 0 4px 4px 0;
  color: var(--ivory-muted);
  padding: 0.75rem 0.25rem;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  writing-mode: vertical-rl;
  letter-spacing: 0.05em;
  transition: all 0.25s ease;
}

.sidebar-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--ink);
}

.sidebar-toggle:not(.sidebar-hidden) {
  left: 280px;
}

/* Project main area fills full width */
.project-main {
  flex: 1;
  min-width: 0;
}

.project-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
}

.project-panes {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Left pane: Instructions */
.project-instructions {
  width: 50%;
  overflow-y: auto;
  padding: 0;
  border-right: 1px solid var(--ink-border);
  background: var(--ink);
}

.project-instructions-header {
  padding: 0.75rem 2rem 0.75rem 3rem;
  border-bottom: 1px solid var(--ink-border);
  background: var(--ink-light);
}

.project-back {
  display: inline-block;
  color: var(--ivory-muted);
  text-decoration: none;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  transition: color 0.15s;
}

.project-back:hover {
  color: var(--primary);
}

.project-step-indicator {
  font-size: 0.7rem;
  color: var(--ivory-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ivory);
  margin: 0;
  line-height: 1.3;
}

.project-instructions-body {
  padding: 1rem 2rem 0.5rem;
  color: var(--ivory);
  font-size: 0.9rem;
  line-height: 1.6;
}

.project-instructions-body h2 {
  font-size: 1.05rem;
  color: var(--ivory);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.project-instructions-body h3 {
  font-size: 0.95rem;
  color: var(--ivory-muted);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.project-instructions-body p {
  margin-bottom: 0.6rem;
}

.project-instructions-body code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--emerald);
}

.project-instructions-body ol,
.project-instructions-body ul {
  margin-bottom: 0.6rem;
  padding-left: 1.25rem;
}

.project-instructions-body li {
  margin-bottom: 0.35rem;
}

.project-instructions-body details {
  margin-top: 1.5rem;
}

/* Footer navigation - full width below both panes */
.project-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 2rem;
  background: var(--ink-light);
  border-top: 1px solid var(--ink-border);
}

.project-footer-prev,
.project-footer-next {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ivory-muted);
  background: none;
  border: 1px solid var(--ink-border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.project-footer-prev:hover,
.project-footer-next:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.project-footer-arrow {
  font-size: 0.9rem;
}

.project-footer-next {
  margin-left: auto;
  background: var(--teal-dark);
  color: var(--ivory);
  border-color: var(--teal-dark);
}

.project-footer-next:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--ivory);
}

/* Right pane: Editor */
.project-editor {
  width: 50%;
  display: flex;
  flex-direction: column;
  background: var(--code-bg);
  overflow: hidden;
}

.project-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--ink-light);
  border-bottom: 1px solid var(--ink-border);
  flex-shrink: 0;
}

.project-editor-header span {
  color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.project-editor-actions {
  display: flex;
  gap: 0.5rem;
}

.project-editor-actions .reset-btn {
  background: none;
  color: var(--ivory-muted);
  border: 1px solid var(--ink-border);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  transition: all 0.2s;
}

.project-editor-actions .reset-btn:hover {
  color: var(--ivory);
  border-color: var(--ivory-muted);
}

.project-editor-actions .run-btn {
  background: var(--teal-dark);
  color: var(--ivory);
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  transition: background 0.2s;
}

.project-editor-actions .run-btn:hover {
  background: var(--teal);
}

.project-editor-actions .run-btn:disabled,
.project-editor-actions .test-btn:disabled {
  background: var(--btn-disabled-bg);
  color: var(--btn-disabled-text);
  cursor: default;
}

.project-editor-actions .test-btn {
  background: var(--gold);
  color: var(--ink);
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.2s;
}

.project-editor-actions .test-btn:hover {
  background: var(--gold-hover);
}

/* Code area */
.project-code {
  flex: 1;
  margin: 0;
  padding: 1rem;
  background: var(--code-bg);
  color: var(--ivory);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  outline: none;
  white-space: pre;
  tab-size: 4;
}

.project-code:focus {
  background: var(--code-bg);
}

/* Output area */
.project-output {
  padding: 0.8rem 1rem;
  background: var(--ink);
  color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  border-top: 1px solid var(--ink-border);
  white-space: pre-wrap;
  max-height: 150px;
  overflow-y: auto;
  display: none;
  flex-shrink: 0;
}

.project-output.visible {
  display: block;
}

.project-output.error {
  color: var(--coral);
}

/* Test results in the editor pane */
.project-editor .test-results {
  border-top: 1px solid var(--ink-border);
  max-height: 200px;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Responsive: stack on small screens */
@media (max-width: 900px) {
  .project-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .project-instructions {
    border-right: none;
    border-bottom: 1px solid var(--ink-border);
    max-height: 50vh;
  }

  .project-editor {
    min-height: 50vh;
  }
}
