:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;

  /* Primary Light Theme Palette */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #94a3b8;

  /* Brand Accents (Yogyakarta Cultural Teals & Warm Amber) */
  --brand-primary: #0284c7;
  --brand-primary-hover: #0369a1;
  --brand-primary-light: #e0f2fe;
  --brand-accent: #d97706;
  --brand-accent-light: #fef3c7;
  --brand-success: #10b981;
  --brand-danger: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-main: #0b1120;
  --bg-card: #131c31;
  --bg-card-hover: #1e293b;
  --border-color: #243048;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --brand-primary-light: #0c4a6e;
  --brand-accent-light: #78350f;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
}

/* NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-primary), #024873);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-web {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  background-color: var(--brand-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Search bar */
.nav-search {
  flex: 1;
  max-width: 500px;
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.nav-search input:focus {
  border-color: var(--brand-primary);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.clear-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  border-radius: 50%;
}

.clear-btn:hover {
  color: var(--text-main);
  background-color: var(--border-color);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s;
}

.theme-toggle:hover {
  background-color: var(--bg-main);
  border-color: var(--brand-primary);
}

.sub-nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 1.5rem;
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.counter-badge {
  background-color: var(--brand-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem;
}

.view-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* HERO BANNER */
.hero-card {
  background: linear-gradient(135deg, #034b75, #0284c7);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
  box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.4);
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: 0.03em;
}

.hero-content h1 {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-content p {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
}

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-box:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.85;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--brand-accent);
  color: #fff;
}

.btn-primary:hover {
  background-color: #b45309;
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--brand-primary);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--brand-primary);
}

/* SECTION HEADERS */
.section-container {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.sort-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sort-selector select {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

/* CATEGORY PILLS */
.category-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.pill {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.pill:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--brand-primary);
}

.pill.active {
  background-color: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

/* BOOKS GRID */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}

.book-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.book-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background-color: #cbd5e1;
  overflow: hidden;
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.book-card:hover .book-cover-img {
  transform: scale(1.04);
}

.book-badge-format {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.book-info {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-meta-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-sub);
}

.book-copies-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--brand-success);
  font-weight: 600;
}

.book-copies-badge.empty {
  color: var(--brand-accent);
}

/* EPUSTAKA GRID */
.epustaka-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.epustaka-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.epustaka-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.epustaka-header {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.epustaka-logo {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  background-color: #f1f5f9;
  object-fit: contain;
  border: 1px solid var(--border-color);
}

.epustaka-title h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.epustaka-code {
  font-size: 0.75rem;
  color: var(--brand-primary);
  font-weight: 600;
  text-transform: uppercase;
}

.epustaka-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.epustaka-books-preview {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.epustaka-book-thumb {
  width: 48px;
  height: 68px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

/* SEARCH VIEW */
.search-hero {
  text-align: center;
  max-width: 650px;
  margin: 1.5rem auto 2.5rem;
}

.search-hero h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.search-large-box {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.5rem 0.4rem 1.25rem;
  gap: 0.75rem;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s;
}

.search-large-box:focus-within {
  border-color: var(--brand-primary);
}

.search-large-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
}

.search-meta-bar {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* SHELF VIEW */
.shelf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.shelf-tabs {
  display: flex;
  gap: 0.5rem;
}

.shelf-tab {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.shelf-tab:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

.shelf-tab.active {
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
}

.shelf-item-card {
  display: flex;
  gap: 1.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  align-items: center;
}

.shelf-item-cover {
  width: 90px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: var(--shadow-md);
}

.shelf-item-details {
  flex: 1;
}

.shelf-item-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.shelf-item-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.shelf-item-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.progress-track {
  flex: 1;
  max-width: 250px;
  height: 8px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background-color: var(--brand-primary);
  border-radius: var(--radius-full);
}

.shelf-item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* MODAL OVERLAY & CARD */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  z-index: 10;
}

.modal-close-btn:hover {
  background-color: var(--brand-danger);
  color: #fff;
  border-color: var(--brand-danger);
}

.modal-body {
  padding: 2rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}

.detail-cover-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-cover-img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.detail-info h2 {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.detail-author {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.detail-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.detail-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.detail-desc-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.detail-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.detail-library-box {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-actions {
  display: flex;
  gap: 1rem;
}

/* WEB READER FULLSCREEN MODAL */
.reader-modal {
  position: fixed;
  inset: 0;
  background-color: #fbf0d9; /* Default sepia feel */
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.reader-modal.hidden {
  display: none;
}

.reader-modal.reader-light {
  background-color: #ffffff;
  color: #111827;
}

.reader-modal.reader-sepia {
  background-color: #f7eed8;
  color: #433422;
}

.reader-modal.reader-dark {
  background-color: #121826;
  color: #e5e7eb;
}

.reader-toolbar {
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.reader-modal.reader-dark .reader-toolbar {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.reader-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reader-titles h4 {
  font-size: 1rem;
  font-weight: 700;
}

.reader-titles span {
  font-size: 0.75rem;
  opacity: 0.75;
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reader-theme-selector {
  display: flex;
  gap: 0.25rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: var(--radius-sm);
}

.theme-btn {
  width: 26px;
  height: 26px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  border-radius: 3px;
}

.theme-btn.light { background-color: #fff; color: #111; }
.theme-btn.sepia { background-color: #f7eed8; color: #433422; }
.theme-btn.dark { background-color: #121826; color: #fff; }

.reader-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 3rem 1.5rem;
  display: flex;
  justify-content: center;
}

.reader-page-container {
  max-width: 720px;
  width: 100%;
  font-family: var(--font-serif);
  line-height: 1.8;
  font-size: 1.15rem;
}

.reader-page-container h2 {
  font-family: var(--font-sans);
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.5rem;
}

.reader-page-container p {
  margin-bottom: 1.25rem;
  text-indent: 1.5rem;
  text-align: justify;
}

.reader-footer {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.reader-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-bar-bg {
  width: 180px;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--brand-primary);
}

/* AUTH MODAL */
.auth-modal-card {
  max-width: 440px;
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-header .brand-logo {
  margin: 0 auto 1rem;
}

.auth-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.auth-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.input-with-icon {
  display: flex;
  align-items: center;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  gap: 0.75rem;
}

.input-with-icon input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
}

.auth-notice {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
}

.auth-notice.error {
  background-color: #fef2f2;
  color: var(--brand-danger);
  border: 1px solid #fecaca;
}

.auth-demo-box {
  background-color: var(--bg-main);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
}

.demo-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* SPINNER & EMPTY STATE */
.loading-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--text-sub);
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.25s ease;
}

.toast.success { border-left-color: var(--brand-success); }
.toast.error { border-left-color: var(--brand-danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* FOOTER */
.footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 3rem 1.5rem 1.5rem;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr;
  gap: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.footer-logo {
  margin-bottom: 1rem;
}

.footer-col h3 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.footer-col h4 {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: var(--brand-primary);
}

.footer-col p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.footer-col ul li a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-col ul li a:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  max-width: 1280px;
  margin: 1.5rem auto 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.hidden {
  display: none !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 900px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
  .detail-layout {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .detail-cover-box {
    max-width: 200px;
    margin: 0 auto;
  }
  .detail-badges, .detail-actions {
    justify-content: center;
  }
  .footer-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  .nav-container {
    padding: 0.5rem 1rem;
  }
  .nav-search {
    display: none;
  }
  .hero-content h1 {
    font-size: 1.6rem;
  }
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .reader-toolbar {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }
  .reader-controls {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .reader-footer {
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    justify-content: center;
  }
  .progress-bar-bg {
    width: 100px;
  }
}

/* =============================================================
   NAVBAR CONSOLE PILL
   ============================================================= */
.btn-console-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-console-pill:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-console-pill i {
  width: 15px;
  height: 15px;
  color: var(--brand-primary);
}

.nav-log-badge {
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* =============================================================
   PERSISTENT ERROR MODAL (Never auto-closes)
   ============================================================= */
.error-modal-card {
  max-width: 680px;
  width: 100%;
  border-top: 5px solid #ef4444;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.error-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.error-modal-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .error-modal-icon-badge {
  background-color: #450a0a;
  color: #f87171;
}

.error-modal-title-box {
  flex: 1;
}

.error-modal-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background-color: #fee2e2;
  color: #b91c1c;
  font-size: 0.7rem;
  font-weight: 800;
  font-family: monospace;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .error-modal-badge {
  background-color: #7f1d1d;
  color: #fca5a5;
}

.error-modal-title-box h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.error-modal-title-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.error-modal-body {
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.error-alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: rgba(239, 68, 68, 0.08);
  border-left: 4px solid #ef4444;
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
}

.error-alert-banner i {
  width: 20px;
  height: 20px;
  color: #ef4444;
  flex-shrink: 0;
  margin-top: 2px;
}

.error-solution-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-left: 0.25rem;
}

.error-tech-details {
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.error-tech-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.error-tech-header span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.error-raw-box {
  background-color: #0b0f19;
  color: #38bdf8;
  font-family: 'Consolas', 'Fira Code', monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.error-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* =============================================================
   BOTTOM DOCKED DIAGNOSTIC ACTIVITY CONSOLE
   ============================================================= */
.diagnostic-console {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #0a0f1d;
  color: #e2e8f0;
  border-top: 2px solid #2563eb;
  z-index: 998;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.diagnostic-console.minimized {
  height: 42px;
}

.diagnostic-console:not(.minimized):not(.maximized) {
  height: 270px;
}

.diagnostic-console.maximized {
  height: 65vh;
}

/* Header bar */
.console-header {
  height: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background-color: #0d1527;
  border-bottom: 1px solid #1e293b;
  cursor: pointer;
  user-select: none;
}

.console-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}

.console-pulse-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.6);
  animation: consolePulse 2s infinite;
}

@keyframes consolePulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.console-icon {
  width: 17px;
  height: 17px;
  color: #38bdf8;
}

.console-badge {
  background-color: #1e293b;
  color: #94a3b8;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.console-server-status {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 0.5rem;
  display: inline-block;
}

.console-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.console-filter-group {
  display: flex;
  background-color: #1e293b;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.console-filter-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.console-filter-btn:hover {
  color: #f1f5f9;
}

.console-filter-btn.active {
  background-color: #2563eb;
  color: #ffffff;
}

.btn-console-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-console-tool:hover {
  background: #334155;
  color: #ffffff;
}

.btn-console-tool i {
  width: 13px;
  height: 13px;
}

/* Console Body Stream */
.console-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: 'Consolas', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8rem;
  background-color: #070b14;
}

.console-empty-msg {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #64748b;
  padding: 2rem;
  justify-content: center;
  text-align: center;
  font-style: italic;
  font-size: 0.85rem;
}

.console-empty-msg i {
  width: 24px;
  height: 24px;
}

/* Individual Log Item */
.console-entry {
  background-color: #0d1527;
  border: 1px solid #1e293b;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: background-color 0.15s;
}

.console-entry:hover {
  background-color: #131c33;
}

.console-entry.cat-api {
  border-left-color: #3b82f6;
}

.console-entry.cat-borrow {
  border-left-color: #10b981;
}

.console-entry.cat-drm {
  border-left-color: #a855f7;
}

.console-entry.cat-error {
  border-left-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.06);
}

.console-entry.cat-auth {
  border-left-color: #f59e0b;
}

.console-entry-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.console-time {
  color: #64748b;
  font-size: 0.72rem;
  min-width: 65px;
}

.console-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.console-tag-api { background: #1e3a8a; color: #93c5fd; }
.console-tag-borrow { background: #064e3b; color: #6ee7b7; }
.console-tag-drm { background: #581c87; color: #d8b4fe; }
.console-tag-error { background: #7f1d1d; color: #fca5a5; }
.console-tag-auth { background: #78350f; color: #fde68a; }

.console-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
}

.status-200 { background: #065f46; color: #34d399; }
.status-400 { background: #78350f; color: #fbbf24; }
.status-401, .status-403 { background: #831843; color: #f472b6; }
.status-500, .status-502 { background: #7f1d1d; color: #f87171; }

.console-method {
  font-weight: 700;
  color: #f1f5f9;
}

.console-url {
  color: #38bdf8;
  word-break: break-all;
}

.console-title-text {
  color: #e2e8f0;
  flex: 1;
}

.console-toggle-details-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 0.72rem;
  text-decoration: underline;
  padding: 0;
  margin-left: auto;
}

.console-toggle-details-btn:hover {
  color: #38bdf8;
}

.console-details-pane {
  margin-top: 0.4rem;
  padding: 0.6rem;
  background-color: #050811;
  border: 1px solid #1e293b;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.console-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #94a3b8;
}

.console-details-code {
  color: #a5f3fc;
  font-size: 0.73rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow-y: auto;
}

/* Ensure bottom space for content so minimized bar does not overlap */
#app {
  padding-bottom: 46px;
}

/* =============================================================
   PDF READER LOADING & DRM DECRYPTION OVERLAY
   ============================================================= */
.pdf-loading-overlay {
  position: absolute;
  inset: 58px 0 0 0;
  background-color: rgba(28, 28, 28, 0.94);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.pdf-loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pdf-loading-overlay.fade-out {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.pdf-loading-box {
  background: #242424;
  border: 1px solid #3d3d3d;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border-radius: 14px;
  padding: 2.2rem 2.5rem;
  max-width: 460px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdf-spinner-ring {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: #0284c7;
  border-right-color: #38bdf8;
  border-radius: 50%;
  animation: pdfSpin 0.9s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
  margin-bottom: 1.25rem;
}

@keyframes pdfSpin {
  to { transform: rotate(360deg); }
}

.pdf-loading-title {
  color: #f3f4f6;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
}

.pdf-loading-subtitle {
  color: #9ca3af;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 1.25rem 0;
}

.pdf-loading-pulse-bar {
  width: 100%;
  height: 4px;
  background: #374151;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  margin-bottom: 1.25rem;
}

.pdf-loading-pulse-bar .pulse-inner {
  position: absolute;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, #0284c7, #38bdf8, transparent);
  animation: pulseBar 1.6s ease-in-out infinite;
}

@keyframes pulseBar {
  0% { left: -40%; }
  100% { left: 100%; }
}

.pdf-loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: #38bdf8;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
}

/* =============================================================
   FEDERATED MULTI-LIBRARY GATEWAY UI
   ============================================================= */
.federated-gateway-strip {
  margin-top: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.gateway-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  background: #16a34a;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
  animation: dotPulse 2s infinite;
}

@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.gateway-status-text {
  font-weight: 700;
  color: var(--text-main);
}

.gl-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.gl-tag svg {
  width: 12px;
  height: 12px;
}

.gl-tag.ijogja {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.gl-tag.bilibrary {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.gl-tag.ipusnas {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.gl-tag.ijakarta {
  background: rgba(147, 51, 234, 0.12);
  color: #9333ea;
  border: 1px solid rgba(147, 51, 234, 0.3);
}

.gateway-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gateway-toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Switch control */
.switch-control {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-control .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 20px;
}

.switch-control .slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch-control input:checked + .slider {
  background-color: #0284c7;
}

.switch-control input:checked + .slider:before {
  transform: translateX(18px);
}

/* Federated Book Cards Availability Matrix */
.federated-total-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.federated-total-badge.avail {
  background: rgba(22, 163, 74, 0.9);
  color: #fff;
}

.federated-total-badge.out {
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
}

.federated-matrix-preview {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.6rem 0;
  padding: 0.5rem;
  background: var(--bg-main);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.federated-avail-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
}

.federated-avail-pill .lib-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.federated-avail-pill .lib-name {
  color: var(--text-main);
  font-weight: 600;
  flex: 1;
}

.federated-avail-pill .lib-count {
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-size: 0.68rem;
}

.federated-avail-pill .lib-count.in-stock {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
}

.federated-avail-pill .lib-count.empty {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.federated-card-action {
  margin-top: 0.5rem;
}


/* ============================================================= */
/* MULTI-ACCOUNT VAULT & UNIFIED SHELF STYLES                    */
/* ============================================================= */

.nav-account-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-account-btn:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.account-pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 9999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.account-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.account-card.connected {
  border-left: 4px solid var(--primary);
}

.account-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
}

.account-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #fff;
}

.account-card-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.account-card-meta strong {
  color: var(--text-main);
}

.account-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
}

.account-status-tag.connected {
  background: rgba(22, 163, 74, 0.15);
  color: #16a34a;
}

.account-status-tag.disconnected {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}

.account-actions {
  display: flex;
  gap: 0.5rem;
}

/* Shelf Library Filter Strip */
.shelf-library-filter-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0 1rem 0;
  margin-bottom: 0.5rem;
  scrollbar-width: thin;
}

.shelf-lib-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.shelf-lib-filter-btn:hover {
  color: var(--text-main);
  border-color: var(--primary);
}

.shelf-lib-filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.shelf-item-lib-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  text-transform: uppercase;
}


/* ============================================================= */
/* HIGH-PERFORMANCE SEARCH & FILTERING TOOLBAR                   */
/* ============================================================= */
.search-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.search-duration-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono, monospace);
  color: var(--primary, #0284c7);
  background: rgba(2, 132, 199, 0.1);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.search-filter-toolbar {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  animation: fadeIn 0.25s ease-out;
}

.filter-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-chips-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-main, #f8fafc);
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--primary, #0284c7);
  color: var(--text-main, #0f172a);
}

.filter-chip.active {
  background: rgba(2, 132, 199, 0.12);
  color: var(--primary, #0284c7);
  border-color: var(--primary, #0284c7);
  font-weight: 600;
}

.chip-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.chip-status-dot.in-stock {
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.chip-status-dot.queue {
  background: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
}

.chip-count {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.06);
  font-weight: 600;
  color: inherit;
}

.filter-chip.active .chip-count {
  background: var(--primary, #0284c7);
  color: #ffffff;
}

.filter-refine-box {
  display: flex;
  align-items: center;
  position: relative;
  background: var(--bg-main, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  padding: 0 0.65rem;
  min-width: 260px;
  flex: 1;
  max-width: 380px;
  transition: border-color 0.2s ease;
}

.filter-refine-box:focus-within {
  border-color: var(--primary, #0284c7);
  background: var(--bg-card, #ffffff);
}

.filter-refine-box i {
  color: var(--text-muted, #94a3b8);
  width: 15px;
  height: 15px;
}

.filter-refine-box input {
  border: none;
  background: transparent;
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  color: var(--text-main, #0f172a);
  outline: none;
  width: 100%;
}

.clear-refine-btn {
  background: none;
  border: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
}

.clear-refine-btn:hover {
  color: var(--text-main, #0f172a);
}

.filter-row-bottom {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-color, #e2e8f0);
}

.filter-dropdown-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}

.filter-dropdown-wrap i {
  width: 15px;
  height: 15px;
}

.filter-select {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-main, #f8fafc);
  font-size: 0.82rem;
  color: var(--text-main, #0f172a);
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-select:hover, .filter-select:focus {
  border-color: var(--primary, #0284c7);
  background: var(--bg-card, #ffffff);
}

.ml-auto {
  margin-left: auto;
}

@media (max-width: 768px) {
  .ml-auto {
    margin-left: 0;
  }
  .filter-row-top, .filter-row-bottom {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-refine-box {
    max-width: 100%;
    min-width: 100%;
  }
  .filter-dropdown-wrap {
    width: 100%;
    justify-content: space-between;
  }
  .filter-select {
    flex: 1;
    max-width: 65%;
  }
}

.search-load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 2rem 0 1rem 0;
}

.search-load-more-wrap button {
  min-width: 220px;
}


/* ============================================================= */
/* INTERACTIVE MULTI-LIBRARY BORROW DESTINATION HUB              */
/* ============================================================= */
.borrow-destination-hub {
  margin: 1.25rem 0;
  padding: 1rem 1.15rem;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.borrow-hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
  color: var(--text-main, #0f172a);
}

.hub-count-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background: rgba(2, 132, 199, 0.1);
  color: var(--primary, #0284c7);
}

.borrow-destination-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.borrow-destination-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--bg-main, #f8fafc);
  transition: all 0.2s ease;
  gap: 0.85rem;
}

.borrow-destination-card:hover {
  border-color: var(--primary, #0284c7);
  background: var(--bg-card, #ffffff);
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.08);
}

.borrow-destination-card.selected {
  border-color: var(--primary, #0284c7);
  background: rgba(2, 132, 199, 0.03);
}

.dest-card-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
}

.dest-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.dest-card-icon i {
  width: 20px;
  height: 20px;
}

.dest-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dest-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.dest-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffffff;
  padding: 0.12rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.dest-card-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.76rem;
  flex-wrap: wrap;
}

.dest-stock.in-stock {
  color: #16a34a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.dest-stock.in-stock i {
  width: 14px;
  height: 14px;
}

.dest-stock.empty {
  color: #d97706;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.dest-stock.empty i {
  width: 14px;
  height: 14px;
}

.dest-account-status.connected {
  color: #0284c7;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.dest-account-status.connected i {
  width: 14px;
  height: 14px;
}

.dest-account-status.disconnected {
  color: var(--text-muted, #94a3b8);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.dest-account-status.disconnected i {
  width: 14px;
  height: 14px;
}

.dest-card-action {
  flex-shrink: 0;
}

.btn-connect-borrow {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.35);
  font-weight: 600;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  cursor: pointer;
  font-size: 0.82rem;
}

.btn-connect-borrow:hover {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
}

@media (max-width: 640px) {
  .borrow-destination-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .dest-card-action button, .dest-card-action .btn-connect-borrow {
    width: 100%;
    justify-content: center;
  }
}
