/* ═══════════════════════════════════════════════
   ARTBOOK — Library Page
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;300;400;500&family=Sora:wght@200;700&family=Space+Grotesk:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f2ee;
  --paper: #faf8f5;
  --ink: #1a1a1a;
  --muted: #888;
  --border: #e0dbd4;
  --accent: #ff4d2d;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg) !important;
  color: var(--ink) !important;
  min-height: 100vh;
  overflow: auto !important;
  display: block !important;
  align-items: unset !important;
  justify-content: unset !important;
}
/* ── Page title ───────────────────────────────── */
.lib-heading {
  padding: 96px 48px 0;
}
.lib-title {
  font-family: 'Sora'; font-weight: 700; font-size: 42px;
  letter-spacing: -1px; color: var(--ink); margin: 0;
}
.lib-title span { font-weight: 200; }
/* ── Grid ────────────────────────────────────── */
.lib-grid {
  display: flex; flex-wrap: wrap; gap: 48px;
  padding: 32px 48px 80px;
}

/* ── Book card ───────────────────────────────── */
.lib-card {
  display: flex; flex-direction: column; gap: 14px;
  text-decoration: none; color: inherit;
  cursor: pointer;
}
.lib-card:hover .lib-book { transform: translateY(-6px) rotate(-1.5deg); }
.lib-card:hover .lib-book-cover { box-shadow: 6px 16px 40px rgba(0,0,0,.35); }

.lib-book {
  display: flex;
  transition: transform .3s cubic-bezier(.22,.68,.35,1);
}

/* Spine */
.lib-book-spine {
  width: 14px;
  border-radius: 3px 0 0 3px;
  background: var(--lc-spine, #0f0f0f);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset -2px 0 6px rgba(0,0,0,.3);
}
.lib-book-spine span {
  font-family: 'Space Grotesk'; font-size: 7px; font-weight: 500;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--lc-spine-text, rgba(255,255,255,.5));
  writing-mode: vertical-rl; transform: rotate(180deg);
  white-space: nowrap; overflow: hidden;
  max-height: 100px; text-overflow: ellipsis;
}

/* Cover face */
.lib-book-cover {
  width: 150px; height: 216px;
  border-radius: 0 4px 4px 0;
  background: var(--lc-cover, #0f0f0f) center/cover no-repeat;
  position: relative; overflow: hidden;
  box-shadow: 4px 10px 28px rgba(0,0,0,.28);
  transition: box-shadow .3s;
  display: flex; flex-direction: column;
}
/* Light overlay */
.lib-book-cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.07) 0%, transparent 40%, rgba(0,0,0,.2) 100%);
  z-index: 1; pointer-events: none;
}
.lib-cover-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  height: 100%; padding: 16px 14px 14px;
}
.lib-cover-label {
  font-family: 'Space Grotesk'; font-size: 6px; font-weight: 500;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: rgba(255,255,255,.5); display: block;
  width: fit-content; margin-bottom: auto;
}
.lib-cover-title-block { margin-top: auto; }
.lib-cover-title {
  font-family: 'Sora'; font-weight: 700; font-size: 16px;
  line-height: 1.1; color: #fff;
  text-transform: uppercase; letter-spacing: -.3px; margin-bottom: 5px;
}
.lib-cover-title span { display: block; }
.lib-cover-title .thin { font-weight: 200; opacity: .9; }
.lib-cover-author {
  font-family: 'Space Grotesk'; font-weight: 500; font-size: 7px;
  letter-spacing: .8px; color: rgba(255,255,255,.7);
  text-transform: uppercase;
}
.lib-cover-year {
  position: absolute; bottom: 12px; right: 12px; z-index: 2;
  font-family: 'Sora'; font-weight: 200; font-size: 9px;
  color: rgba(255,255,255,.35); letter-spacing: 1px;
}

/* ── Card meta ───────────────────────────────── */
.lib-card-meta {
  display: flex; flex-direction: column; gap: 2px;
  padding-left: 14px;
}
.lib-card-name {
  font-family: 'Space Grotesk'; font-weight: 500; font-size: 11px;
  color: var(--ink); letter-spacing: .3px;
}
.lib-card-sub {
  font-family: 'Outfit'; font-weight: 300; font-size: 10px;
  color: var(--muted);
}

/* ── Active badge ────────────────────────────── */
.lib-active-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'Space Grotesk'; font-weight: 500; font-size: 9px;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--accent); margin-top: 2px; padding-left: 14px;
}
.lib-active-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}

/* ── Empty state ─────────────────────────────── */
.lib-empty {
  width: 100%; padding: 80px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px; font-weight: 300;
}
.lib-empty strong { display: block; font-size: 18px; font-weight: 500; color: var(--ink); margin-bottom: 8px; }

/* ── Modal dialog ─────────────────────── */
#lib-modal {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#lib-modal-box {
  background: rgba(18,18,18,.97);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 32px 32px 26px;
  width: 100%; max-width: 360px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  opacity: 0; transform: scale(.95) translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}
#lib-modal-box.show { opacity: 1; transform: none; }
#lib-modal-msg {
  font-family: 'Outfit'; font-size: 15px; font-weight: 400;
  color: #eee; line-height: 1.55; margin-bottom: 20px;
}
#lib-modal-msg strong { color: #fff; font-weight: 600; }
#lib-modal-msg span   { font-size: 12px; color: #888; display: block; margin-top: 6px; }
#lib-modal-input-wrap { margin-bottom: 20px; }
#lib-modal-input {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; color: #fff;
  font-family: 'Outfit'; font-size: 14px;
  outline: none; transition: border-color .2s;
}
#lib-modal-input:focus { border-color: rgba(255,255,255,.35); }
#lib-modal-btns {
  display: flex; justify-content: flex-end; gap: 10px;
}
#lib-modal-btns button {
  padding: 9px 22px; border-radius: 999px; border: none;
  font-family: 'Space Grotesk'; font-size: 11px; font-weight: 500;
  letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer; transition: background .15s, color .15s;
}
#lib-modal-cancel {
  background: rgba(255,255,255,.06); color: #999;
}
#lib-modal-cancel:hover { background: rgba(255,255,255,.12); color: #fff; }
#lib-modal-ok {
  background: rgba(255,255,255,.12); color: #fff;
}
#lib-modal-ok:hover { background: rgba(255,255,255,.22); }
#lib-modal-ok.danger { background: rgba(220,30,30,.25); color: #ff6b6b; }
#lib-modal-ok.danger:hover { background: rgba(220,30,30,.45); color: #fff; }

/* ── Delete button on card ──────────────────── */
.lib-delete-btn {
  display: none; align-items: center; gap: 5px;
  margin-top: 4px; padding-left: 14px;
  background: none; border: none; cursor: pointer;
  font-family: 'Space Grotesk'; font-size: 9px; font-weight: 500;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: #bbb; transition: color .2s;
}
.lib-delete-btn:hover { color: #e03; }
.lib-delete-btn svg { flex-shrink: 0; }

/* ── New Book card ───────────────────────────── */
.lib-new-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; cursor: pointer;
  background: transparent; border: none; padding: 0;
  color: var(--muted); transition: color .2s;
}
.lib-new-card:hover { color: var(--ink); }
.lib-new-card:hover .lib-new-icon { border-color: var(--ink); transform: translateY(-6px); }
.lib-new-icon {
  width: 120px; height: 160px;
  border: 1.5px dashed var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s, transform .3s cubic-bezier(.22,.68,.35,1);
}
.lib-new-icon svg { width: 28px; height: 28px; stroke: currentColor; }
.lib-new-card span {
  font-family: 'Space Grotesk'; font-weight: 500; font-size: 10px;
  letter-spacing: 2px; text-transform: uppercase;
}
