@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #f8fafc;
  --sidebar-bg: #ffffff;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #0056c6;
  --primary-gradient: linear-gradient(135deg, #0066eb, #0044a3);
  --primary-hover: #0044a3;
  --accent-green: #22c55e;
  --accent-green-bg: #e6f9ed;
  --accent-blue: #3b82f6;
  --accent-blue-bg: #eff6ff;
  --accent-yellow: #f59e0b;
  --accent-yellow-bg: #fef9c3;
  --accent-red: #ef4444;
  --accent-red-bg: #fef2f2;
  --accent-grey: #6b7280;
  --accent-grey-bg: #f3f4f6;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 30px;
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

body {
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

/* App Wrapper for Sidebar Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Layout */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  transition: width 0.25s ease, transform 0.25s ease;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1100;
}

.nav-locked {
  overflow: hidden;
}

.sidebar-collapsed {
  width: 88px;
  padding-inline: 12px;
}

.sidebar-collapsed .sidebar-logo span,
.sidebar-collapsed .sidebar-item a span,
.sidebar-collapsed .profile-card .profile-info,
.sidebar-collapsed .sidebar-footer .btn span,
.sidebar-collapsed .sidebar-footer .profile-role {
  display: none;
}

.sidebar-collapsed .sidebar-item a {
  justify-content: center;
  padding-inline: 10px;
}

.sidebar-collapsed .profile-card {
  justify-content: center;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1095;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 36px;
}

.sidebar-logo img {
  height: 32px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  flex-grow: 1;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.sidebar-item a:hover {
  background: var(--bg);
  color: var(--text-main);
}

.sidebar-item.active a {
  background: #22c55e;
  color: #ffffff;
}

.sidebar-item.active a svg, .sidebar-item.active a i {
  color: #ffffff;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  background: #cbd5e1;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.profile-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* flexbox text truncation fix */
  background: var(--bg);
}

.top-nav {
  height: 70px;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.public-topnav {
  gap: 18px;
}

.guest-nav-links,
.guest-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  font-weight: 700;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 84vw;
  max-width: 320px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(-110%);
  transition: transform 0.25s ease;
  z-index: 1110;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

.mobile-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mobile-nav-drawer a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 700;
}

.mobile-nav-drawer a:hover {
  background: var(--bg);
}

.top-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
}

.search-box input {
  padding: 8px 16px 8px 38px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  width: 240px;
  transition: width 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  width: 300px;
  background: #fff;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.nav-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.nav-icon-btn:hover {
  background: var(--bg);
  color: var(--text-main);
}

.sidebar-toggle {
  display: none;
}

.nav-icon-btn .badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--accent-red);
  border-radius: 50%;
  border: 1px solid var(--sidebar-bg);
}

.content-body {
  padding: 32px;
  flex-grow: 1;
}

/* Layout Grids */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 2.2fr 1fr;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card.hoverable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Stat Card */
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.stat-icon.green { background: var(--accent-green-bg); color: var(--accent-green); }
.stat-icon.yellow { background: var(--accent-yellow-bg); color: var(--accent-yellow); }
.stat-icon.red { background: var(--accent-red-bg); color: var(--accent-red); }
.stat-icon.grey { background: var(--accent-grey-bg); color: var(--accent-grey); }

.stat-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.stat-trend {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  align-self: flex-start;
  margin-top: 4px;
}

.stat-trend.up { background: var(--accent-green-bg); color: var(--accent-green); }
.stat-trend.down { background: var(--accent-red-bg); color: var(--accent-red); }

/* Table styling */
.table-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.table-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
}

.table-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.table-search {
  position: relative;
}

.table-search input {
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.85rem;
  width: 200px;
}

.table-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  background: var(--bg);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

/* Scanner panel and mobile-friendly catalog layout */
.scanner-shell {
  padding: 18px;
}

.scanner-header {
  margin-bottom: 8px;
}

.scanner-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
  line-height: 1.45;
}

.scanner-camera-container {
  min-height: 320px;
}

.catalog-header {
  align-items: flex-start;
}

.catalog-heading {
  flex: 1 1 320px;
}

.catalog-actions {
  flex: 0 0 auto;
}

.catalog-inline-form {
  align-items: center;
}

@media (max-width: 1024px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .guest-nav-links,
  .guest-actions {
    display: none;
  }

  .main-wrapper {
    width: 100%;
  }

  .app-container {
    position: relative;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1100;
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-collapsed {
    width: 260px;
    padding-inline: 24px;
  }

  .sidebar-collapsed .sidebar-logo span,
  .sidebar-collapsed .sidebar-item a span,
  .sidebar-collapsed .profile-card .profile-info,
  .sidebar-collapsed .sidebar-footer .btn span,
  .sidebar-collapsed .sidebar-footer .profile-role {
    display: inline;
  }

  .sidebar-collapsed .sidebar-item a {
    justify-content: flex-start;
    padding-inline: 16px;
  }

  .sidebar-collapsed .profile-card {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .public-topnav {
    padding: 0 12px;
  }

  .top-nav {
    padding: 0 14px;
    gap: 10px;
    height: auto;
    min-height: 70px;
  }

  .top-title {
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .top-actions {
    gap: 8px;
  }

  .search-box input {
    width: 150px;
  }

  .search-box input:focus {
    width: 180px;
  }

  .content-body,
  .public-container {
    padding: 18px 14px 28px;
  }

  .card,
  .hero-stats-card {
    padding: 18px;
  }

  .scanner-shell {
    padding: 14px;
  }

  .scanner-camera-container,
  .scanner-stage {
    min-height: 280px;
  }

  .catalog-header {
    flex-direction: column;
  }

  .catalog-actions {
    width: 100%;
  }

  .catalog-inline-form {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
  }

  .catalog-inline-form .btn,
  .catalog-inline-form input {
    width: 100%;
  }

  .book-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-title {
    font-size: 1.85rem;
  }

  .hero-desc {
    font-size: 0.94rem;
  }

  .hero-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .public-hero {
    padding: 16px 0 32px;
    gap: 20px;
  }

  .public-hero-panel {
    padding: 24px 20px;
  }
}

/* Book Item in table */
.book-row-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-row-cover {
  width: 40px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.book-row-text {
  display: flex;
  flex-direction: column;
}

.book-row-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

.book-row-author {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Action buttons */
.btn-action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-action:hover {
  background: var(--bg);
}

.btn-action.edit:hover { color: var(--accent-blue); }
.btn-action.delete:hover { color: var(--accent-red); }

/* Badges / Chips */
.pill-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pill-badge.green { background: var(--accent-green-bg); color: var(--accent-green); }
.pill-badge.blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.pill-badge.yellow { background: var(--accent-yellow-bg); color: var(--accent-yellow); }
.pill-badge.red { background: var(--accent-red-bg); color: var(--accent-red); }
.pill-badge.grey { background: var(--accent-grey-bg); color: var(--accent-grey); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 86, 198, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(0, 86, 198, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.9rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.toast.show {
  transform: translateX(0);
}

.toast-border {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.toast.success .toast-border { background: var(--accent-green); }
.toast.info .toast-border { background: var(--accent-blue); }
.toast.warning .toast-border { background: var(--accent-yellow); }
.toast.error .toast-border { background: var(--accent-red); }

.toast-message {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Confirmation Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  max-width: 440px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Live Search Container & Drops */
.live-search-container {
  position: relative;
}

.live-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-top: 8px;
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.live-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid var(--border);
}

.live-search-item:last-child {
  border-bottom: none;
}

.live-search-item:hover {
  background: var(--bg);
}

.live-search-cover {
  width: 32px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
}

.live-search-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
}

.live-search-author {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Rating interface */
.interactive-stars {
  display: flex;
  gap: 4px;
  cursor: pointer;
}

.star {
  font-size: 1.6rem;
  color: #d1d5db;
  transition: color 0.15s ease;
}

.star.active {
  color: var(--accent-yellow);
}

/* Progress bar for achievements */
.achievement-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.achievement-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-yellow-bg);
  color: var(--accent-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.achievement-icon.locked {
  background: var(--accent-grey-bg);
  color: var(--accent-grey);
}

.achievement-progress-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achievement-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.achievement-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.progress-bar-bg {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* BookRing Waitlist Card styles */
.waitlist-sidebar-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.waitlist-book-card {
  display: flex;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.waitlist-book-card:hover, .waitlist-book-card.active {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.waitlist-book-cover {
  width: 42px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

.waitlist-book-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
}

.waitlist-book-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.waitlist-book-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Empty State component */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.empty-state-emoji {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 320px;
  margin-bottom: 20px;
}

/* Loading animations */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

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

/* Grid helper utilities */
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-column { flex-direction: column; }
.w-full { width: 100%; }

/* Pagination style */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

/* Landing Page Hero and layouts */
.page-shell-guest {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.public-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
}

/* ─── Hero section: clean light with decorative library bg ─── */
.hero-section-bg {
  background: #ffffff;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

/* Subtle bookshelf dots/stripe pattern */
.hero-section-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 85% 15%, rgba(59, 130, 246, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 90%, rgba(34, 197, 94, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.04) 0%, transparent 40%);
  pointer-events: none;
}

/* Decorative thin stripes mimicking book spines on far right */
.hero-section-bg::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(180deg,
    #3b82f6 0%, #3b82f6 16.6%,
    #22c55e 16.6%, #22c55e 33.2%,
    #f59e0b 33.2%, #f59e0b 49.8%,
    #ef4444 49.8%, #ef4444 66.4%,
    #a855f7 66.4%, #a855f7 83%,
    #0056c6 83%, #0056c6 100%
  );
  opacity: 0.5;
  pointer-events: none;
}

.public-hero {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 32px;
  padding: 56px 24px 64px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Left text panel */
.public-hero-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

/* Text colors stay default (dark on white bg) */
.public-hero-panel .hero-tag {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.public-hero-panel .hero-title {
  color: var(--text-main);
}

.public-hero-panel .hero-desc {
  color: var(--text-muted);
}

.public-hero-panel .btn-primary {
  background: var(--primary-gradient);
  box-shadow: 0 6px 20px rgba(0, 86, 198, 0.22);
}

.public-hero-panel .btn-primary:hover {
  box-shadow: 0 8px 28px rgba(0, 86, 198, 0.35);
  transform: translateY(-2px);
}

.public-hero-panel .btn-secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}

.public-hero-panel .btn-secondary:hover {
  background: var(--bg);
  border-color: #cbd5e1;
}

.hero-right-stack {
  display: grid;
  gap: 16px;
}

/* Hero visual: library illustration card */
.public-hero-visual {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 50%, #FFFBEB 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 4/3;
}

.public-hero-visual img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  object-fit: contain;
}

/* Stats card: clean white card */
.hero-stats-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

.hero-stats-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-stat-val {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

@media (min-width: 768px) {
  .public-hero {
    grid-template-columns: 1.15fr 0.85fr;
    padding: 72px 24px 80px;
    gap: 48px;
  }
}

.hero-tag {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 20px;
}


.hero-title {
  font-family: var(--font-title);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-main);
  margin-bottom: 16px;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.hero-stat-item {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border: 1px solid var(--border);
}

/* Landing Section Header */
.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 40px auto;
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* popular book card */
.book-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.book-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.book-card-cover-wrap {
  position: relative;
  width: 100%;
  padding-top: 140%; /* 5:7 ratio */
  background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  overflow: hidden;
}

.book-card-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.3s ease;
}

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

.book-card-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-card-category {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.book-card-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6em;
}

.book-card-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.book-card-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.book-card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.book-card-rating i, .book-card-rating svg {
  color: var(--accent-yellow);
}

.book-card-borrows {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* public footer */
.public-footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

/* Custom styles for detail book page */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 768px) {
  .detail-grid {
    grid-template-columns: 280px 1fr;
  }
}

.detail-cover {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  object-fit: cover;
  background: #fff;
}

.detail-header {
  margin-bottom: 24px;
}

.detail-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.detail-author {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.detail-meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-meta-item {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
}

.detail-meta-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detail-meta-val {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-top: 2px;
}

/* Public contact pages forms */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr 1.2fr;
  }
}

.info-item {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.info-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent-blue-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.info-text h4 {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
}

.info-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Barcode drawing container */
.barcode-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 12px;
}

.barcode-svg {
  width: 100%;
  max-width: 240px;
}

.barcode-text {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-top: 8px;
  letter-spacing: 0.2em;
}

/* Camera scan window */
#reader {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  aspect-ratio: 4/3;
  margin-bottom: 16px;
}

/* ── btn-lg ── */
.btn-lg {
  padding: 13px 28px;
  font-size: 1rem;
}

/* ── Book card hover effect ── */
.book-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

/* ── Extra small screens (max 480px) ── */
@media (max-width: 480px) {
  .book-card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .book-card-content {
    padding: 12px;
  }

  .book-card-title {
    font-size: 0.9rem;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .hero-stat-val {
    font-size: 1.4rem;
  }

  .public-hero {
    padding: 24px 16px 28px;
    gap: 16px;
  }

  .public-hero-panel {
    padding: 22px 18px;
  }

  .hero-section-bg {
    padding-bottom: 0;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .public-container {
    padding: 28px 14px;
  }

  .btn-lg {
    padding: 11px 20px;
    font-size: 0.92rem;
  }
}

/* ── Medium screens 481–767px ── */
@media (min-width: 481px) and (max-width: 767px) {
  .book-card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .hero-title {
    font-size: 2rem;
  }
}

/* ── Tablet+ (768px) hero stack becomes side-by-side ── */
@media (min-width: 768px) {
  .hero-right-stack {
    grid-template-rows: 1fr auto;
  }

  .public-hero-visual {
    min-height: 280px;
  }
}

/* ── Large screens (1024px+) ── */
@media (min-width: 1024px) {
  .book-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .hero-title {
    font-size: 3rem;
  }
}

/* ── Profile avatar preview ── */
#avatar-preview {
  display: block;
  border-radius: 50%;
}

/* ── Smooth transition for all images ── */
img {
  transition: opacity 0.2s ease;
}

/* Optimized Sidebar & Mobile Nav sizing to fit mobile screens comfortably */
@media (max-width: 1024px) {
  .sidebar {
    padding: 20px 16px !important;
    gap: 16px !important;
  }
  
  .sidebar-logo {
    margin-bottom: 20px !important;
    font-size: 1.25rem !important;
  }
  
  .sidebar-menu {
    gap: 6px !important;
  }
  
  .sidebar-item a {
    padding: 10px 12px !important;
    font-size: 0.88rem !important;
  }
  
  .sidebar-footer {
    margin-top: 15px !important;
    padding-top: 15px !important;
    gap: 8px !important;
  }
  
  .profile-card {
    padding: 8px !important;
    margin-bottom: 4px !important;
    gap: 8px !important;
  }

  .profile-avatar {
    width: 36px !important;
    height: 36px !important;
  }
  
  .profile-name {
    font-size: 0.85rem !important;
  }
  
  .profile-role {
    font-size: 0.72rem !important;
  }
}