/* ─────────────────────────────────────────────────────────────────────────
   library.css  —  Book Library visual styles
   ───────────────────────────────────────────────────────────────────────── */

/* ── Index page ─────────────────────────────────────────────────────────── */
.library-card {
  transition: box-shadow 0.15s ease;
  border-radius: 8px;
}
.library-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Detail page layout ─────────────────────────────────────────────────── */
.library-detail-page {
  min-height: 100vh;
  background: #f5f0e8;
}
.library-header {
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Collection section ─────────────────────────────────────────────────── */
.collection-section {
  margin-bottom: 2rem;
}
.collection-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 2px solid #c8b99a;
  margin-bottom: 0.75rem;
}
.collection-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: #3d2b1a;
  flex-grow: 1;
}
.collection-actions {
  display: flex;
  gap: 0.35rem;
}

/* ── Shelf plank ────────────────────────────────────────────────────────── */
.shelf-section {
  margin-bottom: 1.25rem;
}
.shelf-label {
  font-size: 0.8rem;
  color: #7a6248;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.shelf-plank {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: linear-gradient(180deg, #c8a96e 0%, #9e7a46 6%, #7a5c30 6%, #7a5c30 92%, #5c3d18 92%, #5c3d18 100%);
  border-radius: 4px 4px 6px 6px;
  padding: 12px 12px 10px 12px;
  min-height: 140px;
  overflow-x: auto;
  position: relative;
}
.shelf-plank.drag-over {
  outline: 2px dashed #4a90d9;
  outline-offset: -4px;
}
.shelf-empty-hint {
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
  align-self: center;
  pointer-events: none;
  user-select: none;
}

/* ── Book spine ─────────────────────────────────────────────────────────── */
.book-spine {
  width: 38px;
  min-width: 38px;
  height: 163px;
  border-radius: 3px 2px 2px 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.32), inset 1px 0 3px rgba(255,255,255,0.16);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex-shrink: 0;
  user-select: none;
}
.book-spine:hover {
  transform: translateY(-6px);
  box-shadow: 3px 6px 10px rgba(0,0,0,0.4), inset 1px 0 3px rgba(255,255,255,0.15);
  z-index: 2;
}
.book-spine.dragging {
  opacity: 0.45;
  transform: scale(0.97);
}
.book-spine.drag-target {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Spine title text — rotated vertical */
.spine-title {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  overflow: hidden;
  max-height: 154px;
  line-height: 1.15;
  padding: 5px 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Search highlight glow */
@keyframes spineGlow {
  0%   { box-shadow: 0 0 0 2px #ffe066, 0 0 14px 4px #ffe066; }
  50%  { box-shadow: 0 0 0 3px #ffc107, 0 0 24px 8px #ffc107; }
  100% { box-shadow: 0 0 0 2px #ffe066, 0 0 14px 4px #ffe066; }
}
.book-spine.highlighted {
  animation: spineGlow 1.2s ease-in-out infinite;
  z-index: 3;
  transform: translateY(-8px);
}

/* ── Book detail panel (slide-in from right) ────────────────────────────── */
.book-detail-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  max-width: 95vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 1050;
  transition: right 0.25s ease;
  overflow-y: auto;
}
.book-detail-panel.open {
  right: 0;
}
.book-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 1040;
}
.book-detail-overlay.active {
  display: block;
}
.book-detail-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #666;
  cursor: pointer;
}
.book-detail-close:hover {
  color: #000;
}
.book-cover-img {
  max-width: 120px;
  box-shadow: 2px 4px 12px rgba(0,0,0,0.2);
  border-radius: 3px;
}
.spine-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.15);
  display: inline-block;
  vertical-align: middle;
}

/* ── CSV preview status badges ──────────────────────────────────────────── */
.csv-status-resolved       { color: #198754; font-weight: 600; }
.csv-status-unresolved_isbn,
.csv-status-unresolved_title,
.csv-status-preview_limit,
.csv-status-invalid_shelf,
.csv-status-unresolved     { color: #dc3545; }
.csv-status-already_on_shelf { color: #6c757d; }
.csv-status-added          { color: #0d6efd; font-weight: 600; }
#csvPreviewTable .bi-info-circle { cursor: help; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 576px) {
  .shelf-plank {
    padding: 8px 8px 6px 8px;
    min-height: 110px;
  }
  .book-spine {
    width: 32px;
    min-width: 32px;
    height: 132px;
  }
  .spine-title {
    font-size: 11.2px;
    max-height: 149px;
    letter-spacing: 0.03em;
  }
}

/* ── Scan modal camera viewport ─────────────────────────────────────── */
#scanReaderContainer { background: #000; }
#scanReaderContainer video { width: 100% !important; height: auto !important; }
#scanReaderContainer > div { width: 100% !important; }
