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

:root {
  --font-sans: 'Outfit', sans-serif;
  
  /* Glassmorphic Light / Dark variables */
  --bg-primary: #05060b;
  --bg-secondary: rgba(255, 255, 255, 0.025);
  --bg-sidebar: rgba(5, 6, 11, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.18);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  
  --accent-color: #e5c158;
  --accent-hover: #cfa83b;
  --accent-light: rgba(229, 193, 88, 0.12);
  
  --danger-color: #f87171;
  --danger-hover: #ef4444;
  --success-color: #34d399;
  --warning-color: #fbbf24;
  
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: rgba(255, 255, 255, 0.45);
  --bg-sidebar: rgba(255, 255, 255, 0.65);
  --border-color: rgba(15, 23, 42, 0.06);
  --border-color-hover: rgba(15, 23, 42, 0.12);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-light: rgba(229, 193, 88, 0.18);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 8px 32px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .bg-blobs {
  background: radial-gradient(circle at 50% 50%, #f1f5f9 0%, #e2e8f0 100%);
}
/* =====================================================
   LIGHT MODE OVERRIDES — Better contrast & visibility
   ===================================================== */
[data-theme="light"] .btn-secondary-premium {
  background-color: rgba(15, 23, 42, 0.06);
  color: var(--text-primary);
  border-color: rgba(15, 23, 42, 0.15);
}
[data-theme="light"] .btn-secondary-premium:hover {
  background-color: rgba(15, 23, 42, 0.10);
  border-color: rgba(15, 23, 42, 0.25);
}
[data-theme="light"] .sidebar {
  background-color: rgba(255, 255, 255, 0.88);
  border-right-color: rgba(15, 23, 42, 0.10);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .mobile-header-bar {
  background-color: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.10) !important;
  box-shadow: 0 1px 12px rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .book-card {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .search-input-premium {
  background-color: rgba(255,255,255,0.8);
  border-color: rgba(15, 23, 42, 0.12);
  color: #0f172a;
}
[data-theme="light"] .table-premium th {
  background-color: rgba(15, 23, 42, 0.04);
  color: #475569;
}
[data-theme="light"] .table-premium td {
  color: #0f172a;
}
[data-theme="light"] .table-container {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .card-stat {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .nav-item a {
  color: #475569;
}
[data-theme="light"] .nav-item a:hover {
  background-color: rgba(15, 23, 42, 0.05);
  color: #0f172a;
}
[data-theme="light"] .pagination-container-premium button {
  color: #0f172a;
}


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

/* Eliminate 300ms double-tap delay on mobile browsers */
button,
a,
.btn-premium,
.btn-secondary-premium,
.modal-close,
.nav-item a,
.sidebar-footer button {
  touch-action: manipulation;
}

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

/* FLOATING LIQUID GLASS BACKGROUND BLOBS */
.bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #080d22 0%, #030408 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.3;
  mix-blend-mode: screen;
  animation: floatAround 25s infinite alternate ease-in-out;
}

.blob-1 {
  top: -10%;
  left: 15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(229, 193, 88, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  animation-duration: 22s;
}

.blob-2 {
  bottom: -15%;
  right: 15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
  animation-duration: 28s;
  animation-delay: -6s;
}

.blob-3 {
  top: 40%;
  left: 40%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
  animation-duration: 24s;
  animation-delay: -12s;
}

@keyframes floatAround {
  0% { transform: translate(0px, 0px) scale(1) rotate(0deg); }
  50% { transform: translate(80px, -60px) scale(1.15) rotate(180deg); }
  100% { transform: translate(-40px, 90px) scale(0.9) rotate(360deg); }
}

/* Sidebar Styling (frosted glass) */
.sidebar {
  width: 280px;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 8px 12px 20px 12px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  letter-spacing: -0.01em;
}

.sidebar-brand img {
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(229, 193, 88, 0.15);
}

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

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item a svg,
.nav-item a i {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
}

.nav-item a:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active a {
  background: var(--accent-light);
  color: var(--accent-color);
  border: 1px solid rgba(229, 193, 88, 0.2);
}

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

/* Main Content Area */
.main-wrapper {
  margin-left: 280px;
  padding: 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s;
  width: 100%;
}

/* Main layout shell: sidebar + content in a row on desktop */
#main-layout {
  display: flex;
  flex-direction: row;
  width: 100%;
  min-height: 100vh;
}

/* Navbar/Header */
.navbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
  position: relative;
}

#loader-wrapper {
  position: absolute;
  right: 0;
  top: 8px;
  z-index: 100;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #05060b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(229, 193, 88, 0.25);
}

/* Glass Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 36px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 36px;
}

.card-stat {
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.card-stat:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md), 0 0 15px rgba(255, 255, 255, 0.02);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.stat-val {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* UI Premium Buttons */
.btn-premium {
  background-color: var(--accent-color);
  color: #05060b;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(229, 193, 88, 0.2);
}

.btn-premium:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2.5px);
  box-shadow: 0 8px 24px rgba(229, 193, 88, 0.45);
}

.btn-secondary-premium {
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border: 1px solid var(--border-color-hover);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-secondary-premium:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.05);
}

.table-container {
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 32px;
}

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

.table-premium th {
  background-color: rgba(0, 0, 0, 0.25);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.table-premium td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

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

.table-premium tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

/* Badge Tags (Pill tag styling) */
.badge-status {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 40px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-available {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-borrowed {
  background-color: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.badge-reserved {
  background-color: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-active {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-suspended {
  background-color: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

/* Modal Overlay & Card (Liquid Glass) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(5, 6, 11, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
}

.modal-overlay.show {
  display: flex !important;
  opacity: 1;
}

.modal-content-premium {
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  background-color: rgba(10, 12, 20, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 36px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.modal-overlay.show .modal-content-premium {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-header-premium {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.modal-close:hover {
  color: var(--text-primary);
}

.form-group-premium {
  margin-bottom: 20px;
}

.form-label-premium {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input-premium {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.form-input-premium:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: rgba(255, 255, 255, 0.05);
}

/* Premium Toast Banner */
.toast-container-premium {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10000;
}

.toast-premium {
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  background-color: rgba(15, 17, 26, 0.85);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-color);
  border-radius: var(--radius-sm);
  padding: 16px 24px;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* Book Catalog Grid & Premium Book Cards */
.book-cover-thumbnail {
  width: 42px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: rgba(0, 0, 0, 0.3);
}

.book-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
  margin-bottom: 32px;
}

.book-card {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md), 0 0 15px rgba(229, 193, 88, 0.05);
}

.book-card-cover-wrapper {
  width: 105px;
  min-width: 105px;
  height: 155px;
  background-color: rgba(0, 0, 0, 0.2);
  position: relative;
  border-right: 1px solid var(--border-color);
}

.book-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-card-details {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.book-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

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

/* Page Loader Spinner styling */
.loader-premium {
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 10px rgba(229, 193, 88, 0.1);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Search input design */
.search-bar-premium {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  width: 100%;
}

.search-input-premium {
  flex-grow: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
}

.search-input-premium:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 12px rgba(229, 193, 88, 0.1);
}

/* Pagination container */
.pagination-container-premium {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  margin-bottom: 24px;
}

/* Responsive Action Bars and Grids */
.catalog-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.circulation-forms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.table-header-responsive {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.catalog-buttons-group {
  display: flex;
  gap: 10px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(5, 6, 11, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* MULTI-DEVICE RESPONSIVE MEDIA QUERIES */
.mobile-header-bar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    /* Fixed at top so it stays put while content scrolls */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    z-index: 101;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
  }
  
  #main-layout {
    flex-direction: column !important;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
    background-color: rgba(5, 6, 11, 0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .mobile-only {
    display: flex !important;
  }
  
  .main-wrapper {
    margin-left: 0 !important;
    padding: 24px 16px;
    /* Push content below the fixed 60px mobile header */
    padding-top: 80px;
    min-height: 100vh;
    width: 100%;
  }
  
  .navbar-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
  }
  
  .navbar-top div:last-child:not(#loader-wrapper) {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  
  .book-card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .card-stat {
    padding: 16px;
  }
  
  .card-stat h3 {
    font-size: 1.4rem;
  }
  
  .modal-content-premium {
    width: 92% !important;
    padding: 28px 24px !important;
    margin: 30px auto !important;
  }
  
  .search-bar-premium {
    width: 100% !important;
  }
  
  .search-input-premium {
    width: 100% !important;
  }

  .catalog-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .circulation-forms-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .table-header-responsive {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .catalog-buttons-group {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  .catalog-buttons-group > button,
  .catalog-buttons-group > div {
    flex: 1 1 calc(50% - 8px) !important;
    min-width: 120px;
  }
  .catalog-buttons-group .btn-premium,
  .catalog-buttons-group .btn-secondary-premium {
    width: 100% !important;
    justify-content: center;
    font-size: 0.85rem !important;
    padding: 10px 12px !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .navbar-top div:last-child:not(#loader-wrapper) {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .btn-premium, .btn-secondary-premium {
    justify-content: center;
    width: 100%;
  }
  .book-card-details {
    padding: 14px 16px !important;
  }
}

.social-link:hover {
  color: var(--accent-gold) !important;
  border-color: var(--accent-gold) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(229, 193, 88, 0.25);
  background: var(--accent-light) !important;
}

/* Reset default browser focus outlines to premium gold glows */
button:focus,
button:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--accent-color) !important;
}

/* Premium Tab Transitions */
.view-panel {
  animation: panelFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Button Loader Styles */
.btn-loader {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* Modal Input & Contrast Overrides (Ensures visibility in Light & Dark Mode) */
.modal-content-premium .form-label-premium {
  color: #9ca3af !important;
}

.modal-content-premium .form-input-premium {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #f9fafb !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.modal-content-premium .form-input-premium::placeholder {
  color: rgba(255, 255, 255, 0.35) !important;
}

.modal-content-premium .form-input-premium:focus {
  border-color: #e5c158 !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 0 0 2px rgba(229, 193, 88, 0.25) !important;
}

.modal-content-premium select.form-input-premium option {
  background-color: #0b132b !important;
  color: #f9fafb !important;
}

.modal-content-premium .modal-title {
  color: #f9fafb !important;
}

.modal-content-premium input[readonly] {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #9ca3af !important;
  cursor: not-allowed;
}

/* ==============================================
   MOBILE PERFORMANCE — eliminate GPU-heavy effects
   that cause lag/jank on phones and tablets
   ============================================== */
@media (max-width: 768px) {
  /* Set solid background on body and hide GPU-heavy blurred blobs completely */
  body {
    background-color: #060913 !important;
    background-image: none !important;
  }
  
  .bg-blobs {
    display: none !important;
  }

  /* Mobile Light Theme Opaque Overrides */
  [data-theme="light"] body {
    background-color: #f8fafc !important;
  }
  [data-theme="light"] .sidebar {
    background-color: #ffffff !important;
    border-right: 1px solid rgba(15, 23, 42, 0.1) !important;
  }
  [data-theme="light"] .navbar-top {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
  }
  [data-theme="light"] .mobile-header-bar {
    background-color: #ffffff !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
  }
  [data-theme="light"] .modal-overlay {
    background-color: rgba(15, 23, 42, 0.45) !important;
  }
  [data-theme="light"] .modal-content-premium {
    background-color: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
  }
  [data-theme="light"] .book-card {
    background-color: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
  }
  [data-theme="light"] .card-stat {
    background-color: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
  }

  /* Completely disable backdrop-filter and -webkit-backdrop-filter
     on mobile. This solves 99% of scroll lag on Safari & iOS Chrome */
  .sidebar,
  .navbar-top,
  .card-stat,
  .modal-content-premium,
  .modal-overlay,
  .book-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Make panels and cards solid opaque dark colors so they look great and remain readable */
  .sidebar {
    background-color: #0c1224 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .navbar-top {
    background-color: #0c1224 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .modal-overlay {
    background-color: rgba(5, 6, 11, 0.92) !important;
    align-items: flex-start !important;
    padding: 24px 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .modal-content-premium {
    background-color: #0c1224 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  .book-card {
    background-color: #121a30 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  .card-stat {
    background-color: #121a30 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  /* Disable hover transitions/transforms on touch — no hover events on phones */
  .book-card,
  .card-stat,
  .btn-premium,
  .btn-secondary-premium,
  .nav-item a {
    transition: background-color 0.1s ease, color 0.1s ease !important;
    will-change: auto !important;
  }

  /* Prevent translateY hover lifts triggering layout recalc */
  .book-card:hover,
  .card-stat:hover {
    transform: none !important;
    box-shadow: inherit !important;
  }
}

/* --- Premium Toggle Switch --- */
.switch-premium {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

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

.slider-premium {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: .3s;
  border-radius: 24px;
}

.slider-premium:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-premium {
  background-color: rgba(199, 160, 40, 0.2); /* Accent gold translucent background */
  border-color: var(--accent-gold);
}

input:checked + .slider-premium:before {
  transform: translateX(22px);
  background-color: var(--accent-gold);
}
