@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  color-scheme: light;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --bg: #eef2f7;
  --panel: #ffffff;
  --border: #d6dbe6;
  --text: #0f172a;
  --muted: #4b5563;
  --sidebar-width: 320px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

body.premium-page {
  overflow: auto;
}

body.sidebar-open {
  overflow: hidden;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  height: 100vh;
  background: #ffffff;
  position: relative;
}

.no-select {
  user-select: none;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: #f8fafc;
  padding: 10px 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100vh;
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease;
  grid-column: 1;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  padding-bottom: 4px;
}

.nav-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.premium-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.premium-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: none;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
  cursor: pointer;
}

.premium-toggle:hover,
.premium-toggle:focus-visible {
  background: #eef2ff;
  outline: none;
}

.premium-toggle-indicator {
  transform: rotate(90deg);
  transition: transform 0.2s ease;
  color: var(--muted);
}

.premium-panel[data-state='collapsed'] .premium-toggle-indicator {
  transform: rotate(0deg);
}

.premium-panel[data-state='collapsed'] .premium-toggle {
  background: #ffffff;
  border: 1px dashed #d9e0ea;
}

.premium-panel[data-state='collapsed'] .premium-collapsible {
  display: none;
}

.premium-toggle.has-premium {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  border: 1px solid #fbbf24;
  color: #92400e;
}

.premium-collapsible {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.premium-banner {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #0f172a;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #fbbf24;
}

.premium-status-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.premium-status-form.is-loading {
  opacity: 0.75;
  pointer-events: none;
}

.premium-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.premium-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.premium-input-row input {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #d9e0ea;
  font-size: 14px;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
  outline: none;
}

.premium-links {
  display: flex;
  justify-content: flex-end;
}

.premium-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.premium-link:hover,
.premium-link:focus-visible {
  text-decoration: underline;
}

.premium-status-message {
  min-height: 18px;
  font-size: 12px;
  color: var(--muted);
}

.premium-status-message[data-variant='error'] {
  color: #dc2626;
}

.premium-status-message[data-variant='success'] {
  color: #16a34a;
}

.helper-text {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.search-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 6px;
}

.icon-button {
  border: 1px solid #d9e0ea;
  background: #ffffff;
  border-radius: 6px;
  padding: 7px 9px;
  cursor: pointer;
  color: #111827;
  font-weight: 700;
  line-height: 1;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: #b9c4d6;
  background: #f7f9fc;
  outline: none;
}

.sidebar-toggle-floating {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 14;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  display: none;
  padding: 14px 6px;
  min-width: unset;
  width: 28px;
  border-radius: 0 10px 10px 0;
}

.sidebar-toggle-floating.visible {
  display: inline-flex;
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: #6b7280;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  width: 100%;
  color: var(--text);
}

.nav-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.nav-scroll {
  overflow: auto;
  padding-right: 0;
  flex: 1;
  min-height: 0;
}

.nav-list {
  list-style: none;
  padding: 0 2px 10px 2px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section {
  --section-color: var(--accent);
}


.nav-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 12px;
  font-weight: 700;
  color: var(--section-color);
  padding: 7px 10px 6px 8px;
  text-transform: none;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--section-color) 12%, #f8fafc);
  z-index: 1;
  border: none;
  cursor: pointer;
  text-align: left;
  border-left: 3px solid var(--section-color);
}

.nav-section-heading:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--section-color) 40%, #000000);
  outline-offset: 2px;
}

.nav-section-heading .nav-section-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  color: currentColor;
  transition: transform 0.15s ease;
  transform: rotate(90deg);
}

.nav-section.is-collapsed .nav-section-arrow {
  transform: rotate(0deg);
}

.nav-section-heading::first-letter {
  font-weight: 800;
}

.nav-section-list,
.nav-sublist {
  list-style: none;
  margin: 0;
  padding: 2px 0 4px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section.is-collapsed .nav-section-list {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
}

.nav-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 5px 10px 5px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background 0.12s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(37, 99, 235, 0.08);
  outline: none;
}

.nav-label {
  min-width: 28px;
  height: 22px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--section-color) 30%, #ffffff);
  color: var(--section-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  padding: 0 6px;
}

.nav-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-title {
  font-weight: 600;
  color: #0f172a;
  font-size: 13px;
}

.nav-sublist {
  padding-left: 14px;
  padding-right: 6px;
}

.nav-link.is-subtable .nav-label {
  font-weight: 700;
  font-style: normal;
}

.nav-link.is-subtable .nav-title {
  font-style: italic;
  font-weight: 500;
}

.nav-link.is-subtable {
  padding-left: 10px;
}

.nav-section[data-theme='algemeen'] {
  --section-color: #c94195;
}

.nav-section[data-theme='natuurkunde'] {
  --section-color: #0163ac;
}

.nav-section[data-theme='wiskunde'] {
  --section-color: #a0341a;
}

.nav-section[data-theme='scheikunde'] {
  --section-color: #ff3b2d;
}

.nav-section[data-theme='biologie'] {
  --section-color: #2c9a44;
}

.nav-section[data-theme='register'] {
  --section-color: #aa9b88;
}

.layout.sidebar-collapsed {
  grid-template-columns: 0px 1fr;
}

.layout.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 11;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.nav-dialog {
  position: fixed;
  inset: 0;
  background: rgba(12, 20, 38, 0.45);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

.nav-dialog.visible {
  display: flex;
}

.nav-dialog-content {
  width: min(1100px, 92vw);
  height: min(86vh, 900px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px 16px;
  border-bottom: 1px solid #e3e8f2;
}

.nav-dialog-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-dialog-title {
  font-weight: 700;
  font-size: 16px;
}

.nav-dialog-toggle {
  border: 1px solid #d9e0ea;
  background: #f8fafc;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-dialog-toggle:hover,
.nav-dialog-toggle:focus-visible {
  background: #eef2ff;
  border-color: #c4cff1;
  outline: none;
}

.premium-panel.is-hidden {
  display: none;
}

.nav-dialog-search {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #e3e8f2;
}

.nav-dialog-list-wrapper {
  flex: 1;
  overflow: auto;
  padding: 8px 10px 12px 10px;
}

.viewer {
  display: flex;
  flex-direction: column;
  grid-column: 2;
  min-height: 100vh;
  background: #ffffff;
}

.viewer-area {
  flex: 1;
  background: #111827;
  display: flex;
  position: relative;
}

.viewer-frame-wrapper {
  flex: 1;
  position: relative;
  background: #1f2937;
}

.viewer-frame-wrapper iframe {
  border: none;
  width: 100%;
  height: 100%;
  background: #111827;
}

.footer-note {
  position: fixed;
  bottom: 12px;
  right: 14px;
  background: rgba(17, 24, 39, 0.8);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
}

.premium-page {
  background: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.08), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(249, 115, 22, 0.08), transparent 25%),
    #f8fafc;
  color: var(--text);
  min-height: 100vh;
}

.premium-header {
  display: block;
}

.premium-brand {
  letter-spacing: -0.01em;
}

.premium-logo {
  text-decoration: none;
}

.premium-tag {
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.premium-nav-link {
  text-decoration: none;
}

.premium-nav-link:hover,
.premium-nav-link:focus-visible {
  text-decoration: underline;
}

.premium-main {
  width: 100%;
}

.premium-hero-text h1 {
  margin: 0;
}

.premium-hero-text .lead {
  margin: 0;
}

.eyebrow {
  margin: 0;
}

.premium-card {
  backdrop-filter: blur(6px);
}

.premium-card-header {
  margin-bottom: 0;
}

.premium-form {
  width: 100%;
}

.premium-input {
  background: #f8fafc;
}

.small-print {
  margin: 0;
}

.form-message {
  color: var(--muted);
}

.form-message[data-variant='error'] {
  color: #dc2626;
}

.form-message[data-variant='success'] {
  color: #16a34a;
}

.benefit-icon {
  font-size: 20px;
}

.premium-footer {
  font-size: 13px;
}

.premium-form.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 300px;
  }

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

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

  .sidebar {
    position: fixed;
    z-index: 12;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
  }

  .viewer {
    grid-column: 1;
  }

  .layout.sidebar-collapsed .sidebar {
    transform: translateX(-105%);
    opacity: 0;
  }

  .sidebar-overlay.visible {
    backdrop-filter: blur(2px);
  }

  .nav-dialog-content {
    width: 95vw;
    height: 85vh;
  }
}
