/* ============================================================
   NOTEBOOK SHELF — left rail with A4 page thumbnails
   Polka стоит в начале страницы, прокручивается вместе с контентом
   и уезжает вверх при скролле. Не fixed, не sticky.
   ============================================================ */

:root {
  --shelf-w: 170px;
  --thumb-w: 120px;
}

body {
  padding-left: var(--shelf-w);
}

.shelf {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--shelf-w);
  background: #e9eaee;
  border-right: 1px solid var(--rule);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 20px;
  gap: 16px;
  overflow: hidden;  /* что не помещается — уходит за край */
}

.shelf-cover {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  font-family: inherit;
  position: relative;
}

.shelf-cover .thumb {
  width: var(--thumb-w);
  height: calc(var(--thumb-w) * 1.414);
  background: var(--paper);
  border: 1px solid #c8cbd0;
  border-radius: 1px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.18);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.shelf-cover:hover .thumb {
  box-shadow: 0 3px 10px rgba(60, 64, 67, 0.26);
}
.shelf-cover.active .thumb {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px #1a73e8, 0 1px 4px rgba(26, 115, 232, 0.22);
}

.shelf-cover .caption {
  font-size: 12px;
  color: var(--ink);
  text-align: center;
  line-height: 1.25;
  max-width: var(--thumb-w);
}
.shelf-cover .caption .ru {
  display: block;
  font-weight: 500;
}
.shelf-cover .caption .native {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 1px;
}
.shelf-cover.active .caption .ru { color: #1a73e8; font-weight: 600; }

.shelf-cover.muted {
  cursor: default;
  opacity: 0.55;
}
.shelf-cover.muted:hover .thumb {
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.18);
}
.shelf-cover.muted .caption .status {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-style: normal;
}

@media (max-width: 900px) {
  :root {
    --shelf-w: 120px;
    --thumb-w: 80px;
  }
  .shelf-cover .caption .native { display: none; }
}

/* ============================================================
   STATUS INDICATORS in header (right side)
   ============================================================ */
header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
}
.status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.status-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd0d4;
  flex-shrink: 0;
  transition: background 0.15s;
}
.status-saved.is-saving .status-dot {
  background: #fbbc04;
  animation: pulseDot 1s infinite ease-in-out;
}
.status-saved.is-saved .status-dot { background: var(--ok); }
.status-saved.is-error .status-dot { background: var(--warn); }
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.status-offline.is-ready .status-dot { background: var(--ok); }
.status-offline.is-loading .status-dot {
  background: #fbbc04;
  animation: pulseDot 1s infinite ease-in-out;
}
.status-history-btn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.status-history-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
@media (max-width: 760px) {
  .status-item-label { display: none; }
  .status-history-btn { padding: 5px 10px; font-size: 11px; }
}

/* ============================================================
   VERSION HISTORY MODAL
   ============================================================ */
.history-modal {
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.42);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.history-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}
.history-card {
  background: var(--paper);
  border-radius: 12px;
  width: 480px;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(8px);
  transition: transform 0.2s;
}
.history-modal.is-open .history-card { transform: translateY(0); }
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
}
.history-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.history-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 8px;
}
.history-close:hover { color: var(--ink); }
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.history-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
}
.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
}
.history-row:hover { background: #f1f3f4; }
.history-row .h-when {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
}
.history-row .h-meta {
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 2px;
}
.history-row .h-restore {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.history-row .h-restore:hover { background: #000; }
.history-foot {
  padding: 10px 20px;
  border-top: 1px solid var(--rule);
  font-size: 11px;
  color: var(--ink-dim);
  text-align: center;
}
