/* FDE Interview Sheet — Striver-style */

.fde-sheet-page .app {
  flex: 1;
  min-height: 100vh;
}

.fde-sheet-page .menu-toggle {
  display: none;
}

.sheet-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--topbar-h, 56px));
}

.sheet-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h, 56px);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h, 56px));
  overflow-y: auto;
  padding: 16px 12px 24px;
  border-right: 1px solid var(--border);
  background: var(--bg2);
  z-index: 40;
}

.sheet-sidebar__header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sheet-sidebar__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.sheet-sidebar__progress {
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
}

.sheet-sidebar__progress-bar {
  height: 4px;
  background: var(--code-bg);
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}

.sheet-sidebar__progress-fill {
  height: 100%;
  background: var(--green);
  width: 0%;
  transition: width 0.3s ease;
}

.sheet-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sheet-topic-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  border-left: 2px solid transparent;
}

.sheet-topic-btn:hover {
  background: var(--progress-bg);
  color: var(--fg);
}

.sheet-topic-btn.is-active {
  background: var(--blue-dim);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sheet-topic-btn__count {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  opacity: 0.8;
}

.sheet-topic-btn__done {
  color: var(--green);
  font-size: 10px;
}

.sheet-main {
  flex: 1;
  min-width: 0;
  padding: 0 24px 80px;
  max-width: 1100px;
}

.sheet-hero {
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.sheet-hero__badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
  background: var(--purple-dim);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.sheet-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 12px;
  line-height: 1.15;
}

.sheet-hero__sub {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.65;
  max-width: 720px;
  margin-bottom: 20px;
}

.sheet-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.sheet-stat {
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 100px;
}

.sheet-stat__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
}

.sheet-stat__label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-family: "JetBrains Mono", monospace;
}

.sheet-stat--easy .sheet-stat__value { color: var(--green); }
.sheet-stat--medium .sheet-stat__value { color: var(--yellow); }
.sheet-stat--hard .sheet-stat__value { color: var(--red); }

.sheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.sheet-search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

.sheet-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 14px;
  color: var(--fg);
  outline: none;
}

.sheet-filters {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sheet-filter {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
}

.sheet-filter:hover { color: var(--fg); }

.sheet-filter.is-active {
  background: var(--accent);
  color: #fff;
}

.sheet-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.sheet-topic-header {
  margin-bottom: 16px;
}

.sheet-topic-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 4px;
}

.sheet-topic-header p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.sheet-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.sheet-table thead {
  background: var(--bg-elevated);
  position: sticky;
  top: var(--topbar-h, 56px);
  z-index: 2;
}

.sheet-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.sheet-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--fg);
}

.sheet-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.sheet-table tbody tr:hover {
  background: var(--progress-bg);
}

.sheet-table tbody tr.is-solved {
  opacity: 0.65;
}

.sheet-table tbody tr.is-solved .col-title {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.col-status { width: 52px; text-align: center; }
.col-num { width: 48px; font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted); }
.col-diff { width: 100px; }
.col-action { width: 90px; text-align: right; }

.sheet-check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  color: transparent;
}

.sheet-check.is-done {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
}

.sheet-diff {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  text-transform: capitalize;
}

.sheet-diff--easy { background: var(--green-dim); color: var(--green); }
.sheet-diff--medium { background: var(--yellow-dim); color: var(--yellow); }
.sheet-diff--hard { background: var(--red-dim); color: var(--red); }

.sheet-view-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sheet-view-btn:hover { text-decoration: underline; }

.sheet-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Modal */
.sheet-modal {
  border: none;
  padding: 0;
  max-width: none;
  width: min(720px, 94vw);
  background: transparent;
}

.sheet-modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.sheet-modal__inner {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-height: min(85vh, 800px);
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.sheet-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.sheet-modal__close:hover { color: var(--fg); }

.sheet-modal__meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.sheet-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 20px;
  padding-right: 36px;
}

.sheet-modal__section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.sheet-modal__section p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg);
  margin: 0 0 16px;
}

.sheet-modal__solution {
  background: var(--blue-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}

.sheet-modal__solution div {
  font-size: 14px;
  line-height: 1.65;
  color: var(--fg);
}

.sheet-modal__solution code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
}

.sheet-modal__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sheet-modal__solved {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

.sheet-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.sheet-btn--ghost {
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
}

.sheet-btn--primary {
  background: var(--accent);
  color: #fff;
}

.sheet-btn--primary:hover { background: var(--accent-hover); }

@media (max-width: 900px) {
  .fde-sheet-page .menu-toggle {
    display: flex;
  }

  .sheet-sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h, 56px);
    bottom: 0;
    width: min(300px, 88vw);
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }

  .sheet-sidebar.active {
    transform: translateX(0);
  }

  .sheet-main { padding: 0 16px 60px; }

  .sheet-table thead { top: var(--topbar-h, 56px); }

  .col-diff { display: none; }
}

@media (max-width: 600px) {
  .col-num { display: none; }
  .sheet-toolbar { flex-direction: column; align-items: stretch; }
  .sheet-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

body.fde-sidebar-open {
  overflow: hidden;
}

body.fde-modal-open {
  overflow: hidden;
}

.fde-sheet-page .sidebar-overlay.active {
  display: block;
}

.sheet-view-btn:focus-visible,
.sheet-check:focus-visible,
.sheet-topic-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sheet-milestone-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 200;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--fg);
  transition: transform 0.35s ease;
}

.sheet-milestone-toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.sheet-milestone-toast a {
  color: var(--accent);
  font-weight: 600;
}
