/* ============================================================
   COVERPRESS — library.css
   Раскладка клиентской «Библиотеки» (iBooks-стиль):
   левый сайдбар групп (полок) + плотная сетка обложек.
   Бренд-переменные берутся из main.css (--accent, --border, …).
   ============================================================ */

.lib {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 48px 64px;
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 40px;
  align-items: start;
}

.lib-head {
  max-width: 1280px;
  margin: 0 auto;
  padding: 4px 48px 8px;
}
.lib-title {
  font-size: clamp(26px, 3.2vw, 38px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.lib-sub {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 8px;
}

/* ── Сайдбар групп (полок) ───────────────────────────────────────────────── */
.lib-aside {
  position: sticky;
  top: 24px;
}
.lib-shelves {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.shelf-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-input);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  text-align: left;
  width: 100%;
}
.shelf-link:hover { background: var(--surface); color: var(--text); }
.shelf-link.active {
  background: var(--text);
  color: #fff;
}
.shelf-link.active .shelf-count { color: rgba(255, 255, 255, 0.7); }
.shelf-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
}

/* ── Сетка обложек ───────────────────────────────────────────────────────── */
.lib-main { min-width: 0; }

.lib-section { margin-bottom: 44px; scroll-margin-top: 16px; }
.lib-section-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px 18px;
}

.lib-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.lib-card .lib-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-tile);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-tile);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.lib-card:hover .lib-cover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}
.lib-card .lib-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lib-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.lib-shelf-tag {
  font-size: 12px;
  color: var(--text-3);
}

/* Анонс (нет наших обложек) — приглушённый плейсхолдер. */
.lib-card.is-soon { cursor: default; }
.lib-card.is-soon .lib-cover {
  background:
    linear-gradient(135deg, rgba(0,0,0,0.03), rgba(0,0,0,0.06));
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lib-card.is-soon:hover .lib-cover { transform: none; box-shadow: none; }
.lib-card.is-soon .lib-name { color: var(--text-2); }
.soon-badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  border: 1px dashed var(--border-strong);
  opacity: 0.5;
  border-radius: var(--r-pill);
  padding: 6px 14px;
}

/* ── Подборки клиента (iBooks-стиль) ─────────────────────────────────────── */
.lib-colls { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.lib-colls-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 0 14px 6px;
}
.lib-colls-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3);
}
.lib-colls-add {
  border: none; background: none; cursor: pointer; color: var(--accent);
  font: inherit; font-size: 13px; font-weight: 600; padding: 2px 4px; border-radius: 8px;
}
.lib-colls-add:hover { background: rgba(255,107,71,.1); }
.lib-colls-list { display: flex; flex-direction: column; gap: 2px; }
.coll-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 14px; border-radius: var(--r-input); font-size: 15px; font-weight: 500;
  color: var(--text-2); cursor: pointer; transition: background .2s ease, color .2s ease;
  text-align: left; width: 100%; border: none; background: none;
}
.coll-link:hover { background: var(--surface); color: var(--text); }
.coll-link.active { background: var(--text); color: #fff; }
.coll-link.active .coll-count { color: rgba(255,255,255,.7); }
.coll-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coll-count { font-size: 13px; font-weight: 500; color: var(--text-3); flex: 0 0 auto; }
.lib-colls-empty { padding: 4px 14px; font-size: 13px; color: var(--text-3); line-height: 1.4; }
/* инлайн-ввод названия новой подборки */
.lib-colls-newrow { display: flex; gap: 6px; padding: 6px 14px 2px; }
.lib-colls-newrow input {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border-strong, #ccc);
  border-radius: var(--r-input); font: inherit; font-size: 14px;
}
.lib-colls-newrow input:focus { outline: none; border-color: var(--accent); }
.lib-colls-newrow button {
  border: none; background: var(--accent); color: #fff; border-radius: var(--r-input);
  padding: 0 12px; font: inherit; font-size: 14px; cursor: pointer;
}

/* Кнопка «в подборку» в углу живой карточки (только у вошедшего) */
.lib-card { position: relative; }
.lib-add-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92); color: var(--text);
  border: 1px solid var(--border); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  opacity: 0; transform: scale(.85); transition: opacity .2s ease, transform .2s ease, background .2s ease;
}
.lib-card:hover .lib-add-btn, .lib-add-btn.is-in { opacity: 1; transform: scale(1); }
.lib-add-btn:hover { background: #fff; color: var(--accent); }
.lib-add-btn.is-in { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Поповер выбора подборок — стили в main.css (нужны и в кабинете lk.html). */

/* Заголовок открытой подборки в основной области */
.coll-view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.coll-view-back {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); border-radius: var(--r-pill);
  padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.coll-view-back:hover { color: var(--text); }
.coll-view-title { font-size: 22px; font-weight: 300; letter-spacing: -0.02em; }
.coll-view-rename, .coll-view-del {
  border: none; background: none; cursor: pointer; color: var(--text-3);
  font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 8px;
}
.coll-view-rename:hover { color: var(--text); background: var(--surface); }
.coll-view-del:hover { color: #d14a2a; background: var(--surface); }
.coll-view-empty { grid-column: 1 / -1; padding: 60px 24px; text-align: center; color: var(--text-2); }

/* Карточка заказа внутри подборки (стили + заказы вместе) */
.coll-order-card {
  display: flex; flex-direction: column; gap: 6px; justify-content: center;
  padding: 16px; aspect-ratio: 3 / 4;
  border: 1px solid var(--border); border-radius: var(--r-tile);
  background: var(--surface);
}
.coll-order-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.coll-order-meta { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.coll-order-link { margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }

/* ── Пустая выдача ───────────────────────────────────────────────────────── */
.lib-empty {
  grid-column: 1 / -1;
  padding: 80px 24px;
  text-align: center;
  color: var(--text-2);
}
.lib-empty h2 {
  font-size: 22px;
  font-weight: 300;
  margin-bottom: 8px;
  color: var(--text);
}

/* ── Мобильная адаптация ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lib { grid-template-columns: 1fr; gap: 20px; padding: 12px 20px 56px; }
  .lib-head { padding: 4px 20px 8px; }

  /* Сайдбар → горизонтальная лента полок сверху */
  .lib-aside { position: static; }
  .lib-shelves {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .shelf-link {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    padding: 8px 14px;
  }
  .shelf-count { display: none; }
}

@media (max-width: 560px) {
  .lib { padding: 8px 14px 48px; }
  .lib-head { padding: 4px 14px 8px; }
  .lib-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 12px;
  }
}
