/* Pair Sessions - Styles */

:root {
  --color-bg: #0f0f23;
  --color-surface: #1a1a2e;
  --color-surface-2: #242442;
  --color-hover: #2a2a4a;
    --color-active: #333360;
  --color-border: #333366;
  --color-text: #e0e0f0;
  --color-text-muted: #8888aa;
  --color-primary: #6366f1;
  --color-primary-hover: #818cf8;
  --color-primary-dim: rgba(99, 102, 241, 0.15);
  --color-accent: #06b6d4;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --sidebar-width: 280px;
    --topbar-height: 42px;
    --transition: 200ms ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  height: 100vh;
    overflow: hidden;
}

/* --- Shell layout --- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition);
}

.sidebar__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
    flex-shrink: 0;
}

.sidebar__logo {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 24px;
  font-weight: 700;
}

.sidebar__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.sidebar__search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar__search input {
  width: 100%;
  padding: 6px 10px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text);
  font-size: 12px;
  font-family: inherit;
  transition: border-color 120ms ease;
}

.sidebar__search input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Sidebar actions */
.sidebar__actions {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Filters */
.sidebar__filters {
  padding: 0;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 40vh;
}

/* Accordion */
.accordion {
  border-bottom: 1px solid var(--color-border);
}

.accordion:last-child {
  border-bottom: none;
}

.accordion__title {
  display: block;
  padding: 6px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: color 120ms ease;
}

.accordion__title::-webkit-details-marker {
  display: none;
}

.accordion__title::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 6px;
  font-size: 9px;
  transition: transform 120ms ease;
}

.accordion[open]>.accordion__title::before {
  transform: rotate(90deg);
}

.accordion__title:hover {
  color: var(--color-text);
}

.accordion>.sidebar__tags {
  padding: 0 12px 8px;
}

.sidebar__empty-sm {
  font-size: 10px;
  color: var(--color-text-muted);
  padding: 2px 0;
}

.sidebar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sidebar__tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-family: inherit;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: 3px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 120ms ease;
  }
  
  .sidebar__tag:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
  }
  
  .sidebar__tag.active {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-dim);
  }
  
  /* Session list in sidebar */
  .sidebar__sessions {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
  }
  
  .sidebar__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background 120ms ease;
    width: 100%;
    text-align: left;
    border: none;
    border-left: 2px solid transparent;
    background: none;
  font-family: inherit;
}

.sidebar__item:hover {
  background: var(--color-hover);
  color: var(--color-text);
}

.sidebar__item--active {
  background: var(--color-active);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.sidebar__item-title {
  flex: 1;
  overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__item-date {
  font-size: 10px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.sidebar__item-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sidebar__item-badge[data-diff="hard"],
.sidebar__item-badge[data-diff="expert"] {
  background: var(--color-primary-dim);
  color: var(--color-primary);
}

.sidebar__item-badge[data-diff="medium"] {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
}

.sidebar__item-badge[data-diff="easy"],
.sidebar__item-badge[data-diff="trivial"] {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

.sidebar__empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

.sidebar__footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* --- Main panel --- */
.main-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-panel__topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
  }
  
  .btn-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--color-text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 6px;
    flex-shrink: 0;
  }
  
  .main-panel__content {
    flex: 1;
    overflow: auto;
    padding: 24px 32px;
}

/* --- Views --- */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* Welcome */
.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--color-text-muted);
}

.welcome h2 {
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.welcome-hint {
  margin-top: 2rem;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* --- Buttons --- */
.btn {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 120ms ease;
  background: var(--color-surface);
  color: var(--color-text);
}

.btn:hover {
  border-color: var(--color-primary);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface-2);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border);
  }
  
  .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  /* --- Tabs --- */
  .tab-bar {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.tab-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-family: inherit;
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-bar__spacer {
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.export-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
    min-height: 300px;
    gap: 16px;
    color: var(--color-text-muted);
}

.export-hint {
  font-size: 13px;
}

.export-panel iframe {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: white;
  }
  
  /* --- Session content (detail view) --- */
  .session-content {
    max-width: 800px;
  line-height: 1.8;
}

.session-content h1 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.session-content h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.session-content h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

.session-content p {
  margin-bottom: 0.75rem;
  color: var(--color-text);
}
.session-content ul, .session-content ol { margin: 0.5rem 0 1rem 1.5rem; }
.session-content li { margin-bottom: 0.3rem; }
.session-content code {
  background: var(--color-surface-2);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

.session-content pre {
  background: var(--color-surface);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
}
.session-content pre code { background: none; padding: 0; }
.session-content table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
.session-content th,
.session-content td {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-border);
  text-align: left;
  font-size: 0.9rem;
}
.session-content th { background: var(--color-surface-2); }
.session-content blockquote { border-left: 3px solid var(--color-primary); padding-left: 1rem; color: var(--color-text-muted); margin: 1rem 0; }
.session-content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }

/* --- Editor --- */
.editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.editor-header h2 {
  flex: 1;
  font-size: 1.1rem;
}

.editor-form {
  max-width: 800px;
}

fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
    margin-bottom: 1.25rem;
  background: var(--color-surface);
}

legend {
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 13px;
  color: var(--color-primary);
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
    font-size: 12px;
  color: var(--color-text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

input[type="text"],
input[type="date"],
input[type="number"],
textarea,
.editor-form select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 120ms ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
}

textarea {
  resize: vertical;
}

/* Steps in editor */
.step-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.step-item .step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.step-item .step-number {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 12px;
}

.btn-remove-step {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 1.1rem;
    padding: 0 4px;
}

/* --- Scattered Stack link --- */
.scattered-link {
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0.6;
}

.scattered-link a {
  color: var(--color-accent);
  text-decoration: none;
}

.scattered-link a:hover {
  text-decoration: underline;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  z-index: 1000;
  font-size: 13px;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
}

.toast.success { border-color: var(--color-success); }
.toast.error { border-color: var(--color-danger); }

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100%;
    z-index: 100;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar__toggle {
    display: block;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .btn-hamburger {
    display: block;
  }

  .main-panel__content {
    padding: 16px;
  }

    .form-row {
      grid-template-columns: 1fr;
    }
}
