/* ========== LIBRARY BORIN PAGE v3.0 ========== */
/* Redesigned: no internal sidebar, horizontal source bar, prominent "Lendo Agora" */

/* Layout: single column, full width */
.lib-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - var(--header-h) - 80px);
  overflow: hidden;
}

/* Hide old sidebar (if any leftover) */
.lib-sidebar {
  display: none !important;
}

/* ---- Main Content (full width) ---- */
.lib-main {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

/* ===== LENDO AGORA — Prominent Section ===== */
.lib-lendo-agora {
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.06), rgba(124, 58, 237, 0.06));
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 16px;
  padding: 20px;
}
.lib-lendo-agora-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.lib-lendo-agora-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.lib-lendo-agora-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-dim);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 12px;
}
.lib-lendo-agora-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.lib-lendo-agora-strip::-webkit-scrollbar {
  height: 6px;
}
.lib-lendo-agora-strip::-webkit-scrollbar-track {
  background: transparent;
}
.lib-lendo-agora-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Big "Lendo Agora" cards */
.lib-lendo-card {
  min-width: 260px;
  max-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.lib-lendo-card:hover {
  border-color: var(--primary);
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.lib-lendo-cover {
  width: 72px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.lib-lendo-cover-placeholder {
  width: 72px;
  height: 100px;
  background: var(--surface2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  opacity: 0.4;
  flex-shrink: 0;
}
.lib-lendo-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lib-lendo-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-lendo-author {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-lendo-progress-wrap {
  margin-top: 6px;
}
.lib-lendo-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.lib-lendo-pct {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lib-lendo-pct-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lib-lendo-progress {
  width: 100%;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.lib-lendo-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  transition: width 0.5s;
}
/* Unknown progress in lendo strip */
.lib-lendo-progress.lib-progress-unknown .lib-lendo-progress-fill {
  background: repeating-linear-gradient(90deg, #f59e0b33 0px, #f59e0b66 4px, transparent 4px, transparent 8px);
  animation: lib-progress-pulse 2s ease-in-out infinite;
}

/* Legacy single-row layout support (unused but keep for compat) */
.lib-lendo-info {
  flex: 1;
  min-width: 0;
}

/* ===== STATS ROW ===== */
.lib-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.lib-stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
}
.lib-stat-val {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lib-stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ===== SOURCE FILTER BAR (replaces old sidebar) ===== */
.lib-source-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
}
.lib-source-scroll {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.lib-source-scroll::-webkit-scrollbar {
  display: none;
}
.lib-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  flex-shrink: 0;
}
.lib-source-pill:hover {
  background: var(--surface2);
  color: var(--text);
}
.lib-source-pill.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.lib-source-pill .lib-nav-emoji {
  font-size: 14px;
}
.lib-source-pill .lib-nav-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 8px;
  min-width: 20px;
  text-align: center;
}
.lib-source-pill.active .lib-nav-count {
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary);
}
.lib-source-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* Quick links (icon-only, right side of source bar) */
.lib-quick-links {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 10px;
}
.lib-qlink {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.15s;
}
.lib-qlink:hover {
  background: var(--surface2);
  transform: scale(1.1);
}

/* ===== SEARCH ===== */
.lib-search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.lib-search-wrap {
  flex: 1;
  position: relative;
}
.lib-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-dim);
}
.lib-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  padding: 10px 12px 10px 36px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.lib-search-input:focus {
  border-color: var(--primary);
}
.lib-result-count {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ===== CATEGORY PILLS ===== */
.lib-cat-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lib-cat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.lib-cat-pill:hover {
  border-color: var(--primary);
  color: var(--text);
}
.lib-cat-pill.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* Status filter bar */
.lib-status-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.lib-status-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.lib-status-pill:hover { border-color: var(--primary); color: var(--text); }
.lib-status-pill.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ===== GRID ===== */
.lib-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lib-empty {
  color: var(--text-dim);
  font-size: 14px;
  padding: 40px;
  text-align: center;
}
.lib-show-more {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.lib-show-more:hover { background: var(--surface2); }

/* ===== BOOK CARD ===== */
.lib-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px 14px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.lib-card:hover {
  border-color: var(--primary);
  background: var(--surface2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.lib-card-source {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.9;
}
.lib-card-body { flex: 1; min-width: 0; }
.lib-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-card-author {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-card-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}
.lib-card-src-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lib-card-cat {
  font-size: 10px;
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 8px;
  color: var(--text-muted);
}
.lib-card-date {
  font-size: 10px;
  color: var(--text-dim);
}
.lib-card-times {
  font-size: 10px;
  color: var(--warning);
  font-weight: 700;
}
.lib-card-stars {
  font-size: 11px;
  color: var(--warning);
  margin-top: 4px;
  letter-spacing: 1px;
}

/* Status badges */
.lib-status-badge {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.lib-status-done { background: rgba(0,212,255,0.15); color: #00d4ff; }
.lib-status-published { background: var(--success-dim); color: var(--success); }
.lib-status-wip { background: var(--accent-dim); color: var(--accent); }
.lib-status-editing { background: var(--warning-dim); color: var(--warning); }
.lib-status-planned { background: rgba(107,114,128,0.2); color: var(--text-dim); }

/* ===== THUMBNAIL ON CARDS ===== */
.lib-card-thumb {
  width: 48px;
  min-width: 48px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lib-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lib-card-thumb-icon {
  font-size: 24px;
  opacity: 0.4;
}

/* ===== PROGRESS BAR (thin, bottom of card) ===== */
.lib-card-progress-bar {
  width: 100%;
  height: 3px;
  background: var(--surface2);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  margin-top: auto;
  flex-shrink: 0;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}
.lib-card-progress-bar-fill {
  height: 100%;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  transition: width 0.6s ease;
  min-width: 0;
}

/* Unknown progress indicator — pulsing stripe for books without real tracking */
.lib-progress-unknown .lib-card-progress-bar-fill {
  background: repeating-linear-gradient(90deg, #f59e0b33 0px, #f59e0b66 4px, transparent 4px, transparent 8px);
  animation: lib-progress-pulse 2s ease-in-out infinite;
}
@keyframes lib-progress-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Legacy progress (keep for manuscritos) */
.lib-card-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: visible;
  position: relative;
}
.lib-card-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s;
}
.lib-card-progress-pct {
  position: absolute;
  right: -36px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ===== MANUSCRITOS VIEW ===== */
.lib-manu-group {
  margin-bottom: 20px;
}
.lib-manu-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.lib-manu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.lib-manu-card:hover { border-color: var(--accent); }
.lib-manu-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.lib-manu-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.lib-manu-status {
  font-size: 9px;
  padding: 3px 10px;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.lib-manu-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.lib-manu-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.lib-manu-progress {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}
.lib-manu-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s;
}
.lib-manu-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 32px;
  text-align: right;
}

/* ===== ORDEM VIEW ===== */
.lib-ordem-header {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0 16px;
  text-align: center;
  font-style: italic;
}
.lib-ordem-fase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.lib-ordem-fase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.lib-ordem-emoji { font-size: 28px; }
.lib-ordem-fase-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.lib-ordem-weeks {
  font-size: 11px;
  color: var(--text-dim);
}
.lib-ordem-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.lib-ordem-item:hover { background: var(--surface2); }
.lib-ordem-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-dim);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lib-ordem-info { flex: 1; }
.lib-ordem-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.lib-ordem-author {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== OLD LIBRARY (Qdrant compat) ===== */
.lib-collection {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface2);
  border-radius: 10px; transition: all 0.15s;
}
.lib-collection:hover { background: var(--surface3); }
.lib-coll-icon { font-size: 24px; min-width: 32px; text-align: center; }
.lib-coll-name { font-size: 14px; font-weight: 600; }
.lib-coll-meta { font-size: 11px; color: var(--text-dim); }
.lib-coll-count { margin-left: auto; font-size: 18px; font-weight: 700; color: var(--primary); }
.lib-search-result {
  padding: 10px 12px; background: var(--surface2);
  border-radius: 8px; border-left: 3px solid var(--accent);
}
.lib-search-result .mem-text { font-size: 13px; line-height: 1.5; }
.lib-search-result .mem-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ===== BOOK DETAIL MODAL ===== */
.lib-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}
.lib-modal-overlay.open {
  opacity: 1;
}
.lib-modal-content {
  background: #16213e;
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lib-modal-overlay.open .lib-modal-content {
  transform: translateY(0) scale(1);
}
.lib-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.15s;
}
.lib-modal-close:hover {
  color: var(--text);
  background: var(--surface2);
}
.lib-modal-top {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.lib-modal-cover-wrap {
  flex-shrink: 0;
}
.lib-modal-cover {
  width: 120px;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.lib-modal-cover-placeholder {
  width: 120px;
  height: 170px;
  background: var(--surface2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  opacity: 0.4;
}
.lib-modal-info {
  flex: 1;
  min-width: 0;
}
.lib-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.lib-modal-author {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.lib-modal-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.lib-modal-source-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
}
.lib-modal-cat-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--surface2);
  color: var(--text-muted);
}
.lib-modal-status-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--primary-dim);
  color: var(--primary);
  text-transform: capitalize;
}
.lib-modal-stars {
  font-size: 14px;
  color: var(--warning);
  letter-spacing: 2px;
  margin-bottom: 10px;
}
.lib-modal-progress-wrap {
  margin-top: 6px;
}
.lib-modal-progress-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-weight: 600;
}
.lib-modal-progress {
  width: 100%;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
}
.lib-modal-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  transition: width 0.6s ease;
}
.lib-modal-section {
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.lib-modal-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.lib-modal-section-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}
.lib-modal-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.lib-modal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--primary);
  background: var(--primary-dim);
  transition: all 0.15s;
}
.lib-modal-link:hover {
  background: var(--primary);
  color: #fff;
}
.lib-modal-link-pdf {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
.lib-modal-link-pdf:hover {
  background: #ef4444;
  color: #fff;
}
.lib-modal-link-spotify {
  color: #1db954;
  background: rgba(29, 185, 84, 0.1);
}
.lib-modal-link-spotify:hover {
  background: #1db954;
  color: #fff;
}
.lib-modal-link-youtube {
  color: #ff0000;
  background: rgba(255, 0, 0, 0.1);
}
.lib-modal-link-youtube:hover {
  background: #ff0000;
  color: #fff;
}

/* ===== SIDEBAR DROPDOWN (Biblioteca nav item in main sidebar) ===== */
.nav-item.has-dropdown {
  position: relative;
}
.nav-dropdown-arrow {
  font-size: 8px;
  color: var(--text-dim);
  margin-left: 4px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}
.nav-dropdown-arrow:hover {
  color: var(--primary);
  background: var(--surface2);
}
.lib-nav-dropdown {
  position: relative;
  left: 0;
  top: 0;
  width: 100%;
  background: rgba(22, 33, 62, 0.6);
  border: none;
  border-radius: 0 0 8px 8px;
  padding: 0 4px;
  z-index: 1000;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  margin-left: 8px;
}
.lib-nav-dropdown.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lib-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.lib-dropdown-item:hover {
  background: var(--primary-dim);
  color: var(--primary);
}
.lib-dropdown-emoji {
  font-size: 15px;
  min-width: 22px;
  text-align: center;
}
.lib-dropdown-label {
  flex: 1;
}

/* ===== SIDEBAR LINKS (legacy, hidden in new layout) ===== */
.lib-sidebar-links {
  display: none;
}

/* ===== ORACULO PANEL ===== */
.lib-oracle-panel {
  width: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  border-radius: 0 12px 12px 0;
}
.lib-oracle-panel.open {
  width: 360px;
  min-width: 360px;
}
.lib-oracle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.lib-oracle-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  padding: 8px 16px;
}
.lib-oracle-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lib-oracle-msg {
  display: flex;
}
.lib-oracle-msg.user { justify-content: flex-end; }
.lib-oracle-msg.ai { justify-content: flex-start; }
.lib-oracle-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.lib-oracle-bubble.user {
  background: var(--primary-dim);
  color: var(--primary);
  border-bottom-right-radius: 4px;
}
.lib-oracle-bubble.ai {
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.lib-oracle-bubble.error { color: var(--error); }
.lib-oracle-typing {
  color: var(--accent);
  font-style: italic;
}
.lib-oracle-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.lib-oracle-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  padding: 10px 14px;
  outline: none;
  font-family: inherit;
}
.lib-oracle-input:focus { border-color: var(--accent); }
.lib-oracle-send {
  background: var(--accent-dim);
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}
.lib-oracle-send:hover { background: var(--accent); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .lib-layout { flex-direction: column; height: auto; }
  .lib-main { padding: 12px; }
  .lib-source-bar { flex-wrap: wrap; padding: 8px; }
  .lib-source-scroll { gap: 4px; }
  .lib-source-pill { padding: 5px 8px; font-size: 11px; }
  .lib-source-pill .lib-nav-count { display: none; }
  .lib-quick-links { display: none; }
  .lib-lendo-card { min-width: 220px; max-width: 260px; }
  .lib-lendo-cover { width: 56px; height: 78px; }
  .lib-stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .lib-stat-val { font-size: 22px; }
  .lib-lendo-agora { padding: 14px; }
}

@media (max-width: 480px) {
  .lib-stats-row { grid-template-columns: 1fr 1fr; }
  .lib-card { padding: 10px 12px 12px; gap: 8px; }
  .lib-card-source { width: 30px; height: 30px; font-size: 14px; }
  .lib-card-title { font-size: 13px; }
  .lib-card-thumb { width: 36px; min-width: 36px; height: 48px; }
  .lib-source-bar { padding: 6px; }
  .lib-source-pill { padding: 4px 6px; font-size: 10px; }
  .lib-source-divider { display: none; }
  .lib-lendo-card { min-width: 200px; max-width: 240px; }

  /* Modal responsive */
  .lib-modal-content { padding: 20px 16px; max-height: 90vh; }
  .lib-modal-top { flex-direction: column; align-items: center; text-align: center; }
  .lib-modal-cover { width: 100px; height: 140px; }
  .lib-modal-cover-placeholder { width: 100px; height: 140px; font-size: 36px; }
  .lib-modal-badges { justify-content: center; }
  .lib-modal-links { justify-content: center; }

  /* Dropdown responsive */
  .lib-nav-dropdown { left: 0; top: 0; margin-left: 0; }
}

/* ===== INTERACTIVE MODAL ELEMENTS ===== */

/* Progress slider */
.lib-modal-progress-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary, #2a2a3e);
  outline: none;
  margin: 8px 0 4px;
  cursor: pointer;
}
.lib-modal-progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary, #00d4ff);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(0,212,255,0.4);
}
.lib-modal-progress-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary, #00d4ff);
  cursor: pointer;
  border: none;
}

/* Rating stars */
.lib-modal-rating-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 8px 0;
}
.lib-modal-star-btn {
  cursor: pointer;
  font-size: 18px;
  color: var(--text-dim, #666);
  transition: color 0.15s, transform 0.15s;
  user-select: none;
}
.lib-modal-star-btn:hover {
  color: #f59e0b;
  transform: scale(1.2);
}
.lib-modal-star-btn.filled {
  color: #f59e0b;
}
.lib-modal-rating-val {
  font-size: 13px;
  color: var(--text-dim, #999);
  margin-left: 8px;
}

/* Status select */
.lib-modal-status-select {
  background: var(--bg-tertiary, #2a2a3e);
  border: 1px solid var(--border, #333);
  color: var(--text, #e0e0e0);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* Notes textarea */
.lib-modal-note-input {
  width: 100%;
  background: var(--bg-tertiary, #1a1a2e);
  border: 1px solid var(--border, #333);
  color: var(--text, #e0e0e0);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}
.lib-modal-note-input:focus {
  border-color: var(--primary, #00d4ff);
  outline: none;
}
.lib-modal-save-note {
  margin-top: 6px;
  padding: 6px 16px;
  background: var(--primary, #00d4ff);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.lib-modal-save-note:hover {
  opacity: 0.85;
}

/* Tags */
.lib-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.lib-modal-tag {
  background: var(--bg-tertiary, #2a2a3e);
  color: var(--text-dim, #aaa);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
}

/* Delete button */
.lib-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #333);
}
.lib-modal-delete-btn {
  background: transparent;
  color: var(--error, #ef4444);
  border: 1px solid var(--error, #ef4444);
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.lib-modal-delete-btn:hover {
  background: var(--error, #ef4444);
  color: #fff;
}

/* ===== ADD BOOK MODAL ===== */
.lib-add-modal-content {
  max-width: 480px;
}
.lib-add-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text, #e0e0e0);
}
.lib-add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lib-add-input {
  width: 100%;
  background: var(--bg-tertiary, #1a1a2e);
  border: 1px solid var(--border, #333);
  color: var(--text, #e0e0e0);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}
.lib-add-input:focus {
  border-color: var(--primary, #00d4ff);
  outline: none;
}
.lib-add-row {
  display: flex;
  gap: 8px;
}
.lib-add-select {
  flex: 1;
  background: var(--bg-tertiary, #1a1a2e);
  border: 1px solid var(--border, #333);
  color: var(--text, #e0e0e0);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.lib-add-submit {
  padding: 12px;
  background: var(--primary, #00d4ff);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}
.lib-add-submit:hover {
  opacity: 0.9;
}

/* ================================================================
   LIBRARY LIVE DATA STYLES v3.0
   Now Playing, Spotify Recent, YouTube Recent, Kindle Progress,
   Sync Status, Live Activity Feed
   ================================================================ */

/* --- NOW PLAYING (Spotify) --- */
.lib-now-playing {
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1db95420, #1db95408);
  border: 1px solid #1db95440;
  overflow: hidden;
}
.lib-np-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  position: relative;
}
.lib-np-pulse {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  background: #1db954;
  border-radius: 50%;
  animation: lib-pulse 2s ease-in-out infinite;
}
@keyframes lib-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
.lib-np-art {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.lib-np-art-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: #1db95420;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.lib-np-info {
  flex: 1;
  min-width: 0;
}
.lib-np-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #1db954;
  margin-bottom: 4px;
}
.lib-np-track {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-np-artist {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.lib-np-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.lib-np-progress {
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  overflow: hidden;
}
.lib-np-progress-fill {
  height: 100%;
  background: #1db954;
  border-radius: 2px;
  transition: width 1s linear;
}
.lib-np-open {
  font-size: 28px;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.lib-np-open:hover {
  opacity: 1;
}

/* --- SYNC STATUS BAR --- */
.lib-sync-bar {
  margin-bottom: 12px;
  padding: 8px 14px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.lib-sync-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
}
.lib-sync-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lib-sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.lib-sync-ok { background: #10b981; }
.lib-sync-error { background: #ef4444; }
.lib-sync-running { background: #f59e0b; animation: lib-pulse 1s ease-in-out infinite; }
.lib-sync-unknown { background: #6b7280; }

/* --- LIVE STATS ROW --- */
.lib-live-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lib-live-stat {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.lib-live-stat.spotify { border-left: 3px solid #1db954; }
.lib-live-stat.youtube { border-left: 3px solid #ff0000; }
.lib-live-stat.kindle { border-left: 3px solid #ff9900; }
.lib-live-stat-icon {
  font-size: 24px;
}
.lib-live-stat-body {
  text-align: center;
}
.lib-live-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.lib-live-stat-lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- SPOTIFY RECENTLY PLAYED --- */
.lib-spotify-recent,
.lib-youtube-recent,
.lib-kindle-progress,
.lib-live-activity-feed {
  margin-bottom: 16px;
}
.lib-live-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-left: 4px;
}
.lib-spotify-scroll,
.lib-youtube-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.lib-spotify-card {
  min-width: 160px;
  max-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.lib-spotify-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(29,185,84,0.2);
}
.lib-spotify-card-art,
.lib-spotify-card-art-ph {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.lib-spotify-card-art-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1db95415;
  font-size: 32px;
}
.lib-spotify-card-info {
  padding: 8px 10px;
}
.lib-spotify-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-spotify-card-artist {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-spotify-card-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* --- YOUTUBE RECENTLY WATCHED --- */
.lib-yt-card {
  min-width: 220px;
  max-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.lib-yt-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,0,0,0.15);
}
.lib-yt-card-thumb,
.lib-yt-card-thumb-ph {
  width: 100%;
  height: 124px;
  object-fit: cover;
  display: block;
}
.lib-yt-card-thumb-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff000010;
  font-size: 32px;
}
.lib-yt-card-info {
  padding: 8px 10px;
}
.lib-yt-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.lib-yt-card-channel {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.lib-yt-card-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* --- KINDLE READING PROGRESS --- */
.lib-kindle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lib-kindle-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid #ff9900;
  border-radius: 10px;
}
.lib-kindle-cover {
  width: 48px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.lib-kindle-cover-ph {
  width: 48px;
  height: 68px;
  border-radius: 6px;
  background: #ff990020;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.lib-kindle-info {
  flex: 1;
  min-width: 0;
}
.lib-kindle-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-kindle-author {
  font-size: 12px;
  color: var(--text-dim);
}
.lib-kindle-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 4px 0;
}
.lib-kindle-pct {
  font-size: 16px;
  font-weight: 700;
  color: #ff9900;
}
.lib-kindle-pages {
  font-size: 11px;
  color: var(--text-dim);
}
.lib-kindle-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.lib-kindle-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff9900, #ffb347);
  border-radius: 3px;
  transition: width 0.3s;
}

/* --- LIVE ACTIVITY FEED --- */
.lib-activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.lib-activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.lib-activity-spotify { border-left: 2px solid #1db954; }
.lib-activity-youtube { border-left: 2px solid #ff0000; }
.lib-activity-kindle { border-left: 2px solid #ff9900; }
.lib-activity-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.lib-activity-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.lib-activity-info {
  flex: 1;
  min-width: 0;
}
.lib-activity-title {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-activity-sub {
  color: var(--text-dim);
  font-size: 11px;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .lib-live-stats-row {
    flex-direction: column;
  }
  .lib-live-stat {
    min-width: 100%;
  }
  .lib-np-inner {
    flex-wrap: wrap;
  }
  .lib-np-track {
    font-size: 15px;
  }
}

/* ================================================================
   LIBRARY v4.0 — NEW FEATURES STYLES
   Sort/Format bar, Recommendations, Import, AI Summary,
   Similar Books, Page Tracking
   ================================================================ */

/* ===== SORT + FORMAT BAR ===== */
.lib-sort-format-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}
.lib-sort-section,
.lib-format-section {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.lib-sort-label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
  white-space: nowrap;
}
.lib-sort-pill,
.lib-format-pill {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.lib-sort-pill:hover,
.lib-format-pill:hover {
  background: var(--surface2);
  color: var(--text);
}
.lib-sort-pill.active,
.lib-format-pill.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ===== RECOMMENDATIONS ===== */
.lib-recommendations {
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.04), rgba(124, 58, 237, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 14px;
  padding: 18px;
}
.lib-reco-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.lib-reco-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}
.lib-reco-refresh {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.lib-reco-refresh:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.lib-reco-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}
.lib-reco-error {
  color: var(--error);
  font-size: 13px;
  padding: 10px;
}
.lib-reco-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  padding: 10px;
}
.lib-reco-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.lib-reco-card {
  min-width: 240px;
  max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-shrink: 0;
  transition: all 0.15s;
}
.lib-reco-card:hover {
  border-color: #f59e0b;
  background: var(--surface2);
}
.lib-reco-card-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.lib-reco-card-body {
  flex: 1;
  min-width: 0;
}
.lib-reco-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
}
.lib-reco-card-author {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.lib-reco-card-reason {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-reco-add-btn {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.lib-reco-add-btn:hover {
  background: #10b981;
  color: #fff;
}

/* ===== IMPORT MODAL ===== */
.lib-import-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.lib-import-tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.lib-import-tab:hover {
  color: var(--text);
}
.lib-import-tab.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.lib-import-info {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.5;
}
.lib-import-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}
.lib-import-dropzone:hover,
.lib-import-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
}
.lib-import-summary {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding: 8px 0;
}
.lib-import-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.lib-import-item {
  font-size: 12px;
  color: var(--text);
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
.lib-import-item:last-child {
  border-bottom: none;
}
.lib-import-error {
  color: var(--error);
  font-size: 13px;
  padding: 10px;
}

/* ===== PAGE TRACKING IN MODAL ===== */
.lib-modal-page-track {
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(245, 158, 11, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.15);
}
.lib-modal-page-inputs {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}
.lib-modal-page-inputs label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lib-modal-page-input {
  width: 90px;
  background: var(--bg-tertiary, #1a1a2e);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.lib-modal-page-input:focus {
  border-color: var(--primary);
  outline: none;
}

/* ===== AI SUMMARY IN MODAL ===== */
.lib-modal-ai-section {
  position: relative;
}
.lib-modal-ai-btn {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(0, 212, 255, 0.15));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12px;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  font-weight: 600;
}
.lib-modal-ai-btn:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(0, 212, 255, 0.25));
}
.lib-modal-ai-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ===== SIMILAR BOOKS IN MODAL ===== */
.lib-modal-similar-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lib-similar-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg-tertiary, #1a1a2e);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.lib-similar-item:hover {
  background: var(--primary-dim);
}
.lib-similar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-similar-author {
  font-size: 11px;
  color: var(--text-dim);
}

/* ===== PAGE INFO IN LENDO AGORA STRIP ===== */
.lib-lendo-pages {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

/* ===== RESPONSIVE for new elements ===== */
@media (max-width: 768px) {
  .lib-sort-format-bar {
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px;
  }
  .lib-reco-card {
    min-width: 200px;
    max-width: 240px;
  }
  .lib-modal-page-inputs {
    flex-direction: column;
    gap: 8px;
  }
  .lib-modal-page-input {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .lib-sort-pill,
  .lib-format-pill {
    padding: 3px 6px;
    font-size: 10px;
  }
  .lib-sort-label {
    font-size: 10px;
  }
  .lib-reco-card {
    min-width: 180px;
  }
}
