/*
This style sheet serves the following pages:
    index.ejs, web-dashboard.ejs

If you are to create new pages for the website, use this.
*/

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
body {
  font-family: 'Space Grotesk', sans-serif;
  background-color: #020617;
  color: white;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Starfield ── */
.stars-1, .stars-2, .stars-3 {
  position: fixed; top: 0; left: 0;
  pointer-events: none; z-index: 0;
}
.stars-1 {
  width: 1px; height: 1px; background: transparent;
  box-shadow:
    120px 340px #fff, 450px 89px #fff, 780px 520px #fff, 1200px 150px #fff,
    90px 670px #fff, 1500px 400px #fff, 330px 210px #fff, 880px 760px #fff,
    1650px 90px #fff, 560px 430px #fff, 1380px 620px #fff, 210px 510px #fff,
    970px 280px #fff, 1750px 700px #fff, 640px 150px #fff, 1100px 480px #fff,
    40px 820px #fff, 1420px 250px #fff, 730px 630px #fff, 1850px 180px #fff,
    290px 740px #fff, 1050px 390px #fff, 500px 560px #fff, 1680px 460px #fff,
    160px 120px #fff, 860px 870px #fff, 1310px 130px #fff, 420px 680px #fff;
  animation: twinkle 8s infinite alternate, drift 60s linear infinite;
}
.stars-2 {
  width: 2px; height: 2px; background: transparent;
  box-shadow:
    200px 500px rgba(255,255,255,0.5), 750px 200px rgba(255,255,255,0.4),
    1300px 650px rgba(255,255,255,0.6), 450px 350px rgba(255,255,255,0.5),
    50px 200px rgba(200,220,255,0.6), 550px 600px rgba(200,220,255,0.7);
  animation: twinkle2 10s infinite alternate-reverse, drift 45s linear infinite reverse;
}
.stars-3 {
  width: 3px; height: 3px; background: transparent; border-radius: 50%;
  box-shadow:
    400px 100px rgba(180,200,255,0.7), 950px 300px rgba(180,200,255,0.5),
    1550px 500px rgba(180,200,255,0.8), 700px 700px rgba(200,220,255,0.7);
  animation: twinkle3 14s infinite alternate, drift 80s linear infinite;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 50%, rgba(29,78,216,0.15), transparent 35%),
    radial-gradient(ellipse at 85% 30%, rgba(6,182,212,0.12), transparent 35%),
    radial-gradient(ellipse at 50% 80%, rgba(88,28,135,0.08), transparent 40%);
  animation: nebulaPulse 20s ease-in-out infinite alternate;
}
@keyframes twinkle     { 0%{opacity:.4} 50%{opacity:.9} 100%{opacity:.6} }
@keyframes twinkle2    { 0%{opacity:.3} 33%{opacity:.8} 100%{opacity:.9} }
@keyframes twinkle3    { 0%{opacity:.5} 50%{opacity:1}  100%{opacity:.3} }
@keyframes drift       { from{transform:translateY(0)} to{transform:translateY(-200px)} }
@keyframes nebulaPulse { 0%{opacity:.8} 50%{opacity:1} 100%{opacity:.7} }
@keyframes cardIn      { from{opacity:0;transform:translateY(18px) scale(.97)} to{opacity:1;transform:translateY(0) scale(1)} }
@keyframes slideUp     { from{opacity:0;transform:translateY(24px)} to{opacity:1;transform:translateY(0)} }
@keyframes dropDown    { from{opacity:0;transform:translateY(-24px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeUp      { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
@keyframes spin        { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

/* ── Header ── */
.top-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: 3.25rem; display: flex; align-items: center;
  padding: 0 1.5rem; gap: 1.5rem;
  background: rgba(8,12,24,0.92);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(24px);
}
.header-brand {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; flex-shrink: 0;
}
.header-brand img { height: 1.6rem; filter: brightness(0) invert(1); opacity: 0.85; }
.brand-text {
  display: flex; align-items: center; gap: 0.2rem;
  font-size: 0.8rem; font-weight: 900; letter-spacing: 0.12em;
}
.brand-cs   { color: white; }
.brand-sep  { color: rgba(255,255,255,0.25); margin: 0 0.1rem; }
.brand-scsu { color: #60a5fa; font-weight: 300; }
.hdr-pipe   { width: 1px; height: 1.1rem; background: rgba(255,255,255,0.15); flex-shrink: 0; }

.header-nav { display: flex; align-items: center; gap: 0.1rem; flex: 1; }
.hdr-nav-btn {
  font-size: 0.78rem; font-weight: 500; color: #94a3b8;
  background: none; border: none; font-family: inherit;
  text-decoration: none;
  padding: 0.3rem 0.65rem; border-radius: 0.25rem; cursor: pointer;
  transition: color 0.15s, background 0.15s; white-space: nowrap;
  display: inline-flex; align-items: center;
}
.hdr-nav-btn:hover  { color: white; background: rgba(255,255,255,0.06); }
.hdr-nav-btn.active { color: white; background: rgba(255,255,255,0.08); }

.header-right {
  margin-left: auto; display: flex; align-items: center;
  gap: 0.75rem; flex-shrink: 0;
}
.header-user-name { font-size: 0.78rem; font-weight: 600; color: #64748b; }
.logout-btn {
  font-size: 0.75rem; font-weight: 500; color: #f87171;
  text-decoration: none; transition: color 0.15s;
}
.logout-btn:hover { color: white; }
.sign-in-link {
  font-size: 0.75rem; font-weight: 500; color: #64748b;
  text-decoration: none; transition: color 0.15s;
}
.sign-in-link:hover { color: white; }
.sign-up-btn {
  padding: 0.3rem 0.85rem; border-radius: 9999px;
  border: 1px solid rgba(59,130,246,0.4);
  color: #60a5fa; background: rgba(59,130,246,0.08);
  font-size: 0.75rem; font-weight: 700;
  text-decoration: none; transition: all 0.2s;
}
.sign-up-btn:hover { background: rgba(59,130,246,0.2); border-color: #60a5fa; }

/* Hamburger */
.hamburger {
  display: none; flex-direction: column; justify-content: center;
  align-items: center; gap: 5px; width: 2rem; height: 2rem;
  background: none; border: none; cursor: pointer; flex-shrink: 0; padding: 0;
}
.hamburger span {
  display: block; width: 18px; height: 2px;
  background: #94a3b8; border-radius: 2px; transition: all 0.25s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); background: white; }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: white; }

/* Mobile dropdown */
.mobile-menu {
  display: none; position: fixed; top: 3.25rem; left: 0; right: 0;
  background: rgba(8,12,24,0.97);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(24px);
  flex-direction: column; padding: 0.5rem 0; z-index: 299;
}
.mobile-menu.open { display: flex; }
.mobile-item {
  font-size: 0.875rem; font-weight: 500; color: #94a3b8;
  background: none; border: none; font-family: inherit; text-align: left;
  text-decoration: none;
  padding: 0.75rem 1.5rem; cursor: pointer;
  transition: color 0.15s, background 0.15s; display: block;
}
.mobile-item:hover  { color: white; background: rgba(255,255,255,0.04); }
.mobile-item.active { color: white; }
.mobile-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 0.25rem 0; }
.mobile-user    { padding: 0.5rem 1.5rem; font-size: 0.72rem; color: #475569; }
.mobile-signout { color: #f87171 !important; }

/* ── Page wrap (web-dashboard) ── */
.page-wrap {
  position: relative; z-index: 1;
  padding-top: calc(4rem + env(safe-area-inset-top));
  padding-bottom: 2rem;
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh;
}

/* ── Page (index) ── */
.page { position: relative; z-index: 1; padding-top: 3.25rem; }

/* ── Panel surface ── */
.panel {
  background: rgba(21,25,36,0.84);
  border: 1px solid rgba(71,85,105,0.55);
  border-radius: 1rem;
  box-shadow: 0 24px 44px -22px rgba(2,6,23,0.95), 0 0 0 1px rgba(59,130,246,0.08);
  backdrop-filter: blur(20px);
  transition: border-color 0.5s, box-shadow 0.5s;
}
.panel:hover { border-color: rgba(96,165,250,0.3); }
.panel-title {
  font-size: 0.72rem; letter-spacing: 0.3em; font-weight: 900; text-transform: uppercase;
  background: linear-gradient(to right, #1d4ed8, #2563eb, #1d4ed8);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Workspaces ── */
.workspace { display: none; width: 100%; max-width: 80rem; padding: 0 1rem; flex-direction: column; align-items: center; }
.workspace.active { display: flex; }

/* ── Catalog ── */
.catalog-header { width: 100%; display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.catalog-title  { font-size: 1.5rem; font-weight: 700; }
.catalog-meta   { display: flex; flex-direction: column; align-items: flex-end; }
.catalog-count  { font-size: 0.78rem; font-weight: 600; color: #cbd5e1; }
.catalog-page   { font-size: 0.68rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; }

.filter-row { width: 100%; display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.3rem 0.9rem; border-radius: 9999px; font-family: inherit;
  font-size: 0.68rem; font-weight: 900; letter-spacing: 0.1em; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  color: #94a3b8; transition: all 0.2s;
}
.filter-btn:hover  { background: rgba(255,255,255,0.1); color: white; }
.filter-btn.active { background: rgba(59,130,246,0.2); color: white; border-color: rgba(59,130,246,0.5); box-shadow: 0 0 12px rgba(59,130,246,0.35); }

/* Search bar (inside catalog workspace) */
.search-bar { width: 100%; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.search-bar input {
  flex: 1; padding: 0.45rem 1rem; border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05);
  color: white; font-family: inherit; font-size: 0.8rem; outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.search-bar input:focus       { border-color: rgba(59,130,246,0.5); background: rgba(255,255,255,0.08); }
.search-bar input::placeholder{ color: rgba(148,163,184,0.5); }

/* Book grid */
.catalog-grid {
  width: 100%; display: grid; gap: 0.85rem;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 600px)  { .catalog-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .catalog-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .catalog-grid { grid-template-columns: repeat(5, 1fr); } }

.book-card {
  position: relative; border-radius: 1rem; overflow: hidden;
  border: 1px solid rgba(71,85,105,0.5); background: rgba(21,25,36,0.8);
  cursor: pointer; transition: transform 0.3s, opacity 0.3s, border-color 0.3s, box-shadow 0.3s;
  animation: cardIn 0.45s cubic-bezier(0.16,1,0.3,1) both;
}
.book-card:hover       { transform: scale(1.025); border-color: rgba(96,165,250,0.38); box-shadow: 0 16px 36px -24px rgba(37,99,235,0.5); }
.book-card.checked-out { opacity: 0.6; filter: grayscale(1); border-color: rgba(239,68,68,0.5); }
.book-card.held-for-user { opacity: 1; filter: none; border-color: rgba(168,85,247,0.55); box-shadow: 0 0 0 1px rgba(168,85,247,0.18), 0 18px 36px -26px rgba(168,85,247,0.5); }
.book-card img         { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.book-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, transparent, rgba(15,23,42,0.75) 30%, rgba(15,23,42,0.97));
  padding: 2.5rem 0.75rem 0.75rem;
}
.book-title  { font-size: 0.88rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.2rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { font-size: 0.72rem; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 0.2rem; }
.book-isbn   { font-size: 0.62rem; color: #64748b; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.badge       { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 9999px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.badge-avail { background: rgba(34,197,94,0.2); color: #4ade80; }
.badge-out   { background: rgba(239,68,68,0.2);  color: #f87171; }
.badge-hold  { background: rgba(168,85,247,0.2); color: #c084fc; }
.hold-state-note {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.hold-state-note.active { color: #c084fc; }
.hold-state-note.ready  { color: #fbbf24; }
.hold-state-note.muted  { color: #64748b; }
.book-card-hint {
  margin-top: 0.45rem;
  font-size: 0.58rem;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.modal-open { overflow: hidden; }
.book-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2,6,23,0.82);
  backdrop-filter: blur(16px);
}
.book-modal.open { display: flex; }
.book-modal-card {
  width: min(960px, 100%);
  max-height: calc(100vh - 2.5rem);
  overflow: auto;
  border-radius: 1.2rem;
  border: 1px solid rgba(71,85,105,0.55);
  background: linear-gradient(180deg, rgba(15,23,42,0.98), rgba(15,23,42,0.9));
  box-shadow: 0 36px 64px -32px rgba(2,6,23,0.95);
}
.book-modal-close {
  position: sticky;
  top: 1rem;
  margin-left: auto;
  margin-right: 1rem;
  margin-top: 1rem;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 9999px;
  background: rgba(15,23,42,0.8);
  color: #cbd5e1;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.book-modal-content { padding: 0.5rem 1.4rem 1.5rem; }
.book-modal-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1.4rem;
}
.book-modal-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 1rem;
  border: 1px solid rgba(71,85,105,0.55);
  background: rgba(15,23,42,0.72);
}
.book-modal-head {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.book-modal-title {
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  font-weight: 800;
  line-height: 1.1;
}
.book-modal-author {
  color: #cbd5e1;
  font-size: 0.95rem;
}
.book-modal-subline {
  color: #64748b;
  font-size: 0.8rem;
}
.book-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.book-modal-hold {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.book-modal-hold-btn {
  padding: 0.5rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid rgba(168,85,247,0.35);
  background: rgba(168,85,247,0.14);
  color: #c084fc;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.book-modal-meta {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  margin-bottom: 1rem;
}
.book-meta-card,
.book-copy-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 0.9rem;
}
.book-meta-card { padding: 0.85rem 0.9rem; }
.book-meta-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.35rem;
}
.book-meta-value {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #e2e8f0;
  word-break: break-word;
}
.book-modal-copy {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.book-copy-card { padding: 1rem; }
.book-copy-card.full { grid-column: 1 / -1; }
.book-copy-card h3 {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.55rem;
}
.book-copy-card p {
  font-size: 0.82rem;
  line-height: 1.7;
  color: #cbd5e1;
  white-space: pre-wrap;
}
.book-copy-card p.empty,
.book-meta-value.empty { color: #475569; }

/* Pagination */
.pagination { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: 2rem; flex-wrap: wrap; }
.page-btn {
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 0.72rem; font-weight: 600; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04); color: #94a3b8; transition: all 0.2s;
}
.page-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); color: white; }
.page-btn.active   { background: rgba(59,130,246,0.2); color: white; border-color: rgba(59,130,246,0.5); box-shadow: 0 0 12px rgba(59,130,246,0.35); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-dots         { color: #64748b; font-size: 0.85rem; display: flex; align-items: center; padding: 0 0.25rem; }

/* ── My Books panel ── */
.mybooks-panel { width: 100%; max-width: 52rem; padding: 1.75rem; animation: slideUp 0.4s ease-out; }

.suggest-panel { width: 100%; max-width: 500px; padding: 2rem; animation: slideUp 0.4s ease-out; }

.loans-summary { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.summary-card {
  flex: 1; min-width: 130px; padding: 1rem 1.25rem;
  border-radius: 0.85rem; border: 1px solid;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.summary-card.total   { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.25); }
.summary-card.overdue { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.25); }
.summary-num  { font-size: 2rem; font-weight: 900; line-height: 1; }
.summary-card.total .summary-num   { color: #60a5fa; }
.summary-card.overdue .summary-num { color: #f87171; }
.summary-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #64748b; }

.section-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.85rem; color: white; }
.divider       { width: 100%; height: 1px; background: rgba(71,85,105,0.5); margin: 1.5rem 0; }

.loan-row {
  display: flex; align-items: center; gap: 1rem; padding: 1rem;
  border-radius: 0.85rem; margin-bottom: 0.6rem;
  background: rgba(21,25,36,0.84);
  border: 1px solid rgba(71,85,105,0.55);
  box-shadow: 0 16px 30px -20px rgba(2,6,23,0.95), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.2s;
}
.loan-row:hover   { border-color: rgba(96,165,250,0.25); }
.loan-row.history { background: rgba(21,25,36,0.55); border-color: rgba(71,85,105,0.35); opacity: 0.75; }
.loan-row img     { width: 3rem; height: 4rem; border-radius: 0.4rem; object-fit: cover; flex-shrink: 0; }
.loan-info        { flex: 1; min-width: 0; }
.loan-title       { font-weight: 700; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loan-author      { font-size: 0.72rem; color: #94a3b8; margin-top: 0.1rem; }
.loan-isbn        { font-size: 0.62rem; color: #475569; letter-spacing: 0.05em; margin-top: 0.1rem; }
.loan-due         { font-size: 0.72rem; font-weight: 700; flex-shrink: 0; text-align: right; }
.loan-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}
.loan-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}
.loan-extension-btn {
  padding: 0.45rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.18);
  color: #93c5fd;
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.loan-extension-btn:hover {
  background: rgba(59,130,246,0.28);
  border-color: rgba(96,165,250,0.5);
  transform: translateY(-1px);
}
.loan-extension-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.loan-extension-note {
  font-size: 0.62rem;
  color: #64748b;
  letter-spacing: 0.04em;
}
.due-ok           { color: #60a5fa; }
.due-soon         { color: #facc15; }
.due-overdue      { color: #f87171; }
.due-returned     { color: #475569; }

.due-badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 9999px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.due-badge.ok      { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.due-badge.soon    { background: rgba(234,179,8,0.15);  color: #facc15; border: 1px solid rgba(234,179,8,0.3); }
.due-badge.overdue { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.due-badge.pending { background: rgba(168,85,247,0.14); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.3); }
.due-badge.approved { background: rgba(34,197,94,0.16); color: #86efac; border: 1px solid rgba(34,197,94,0.32); }
.due-badge.rejected { background: rgba(148,163,184,0.16); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.28); }

@media (max-width: 768px) {
  .loan-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .loan-actions {
    width: 100%;
    align-items: flex-start;
    padding-left: 4rem;
  }

  .loan-status-stack {
    align-items: flex-start;
  }
}

.empty-state      { display: flex; flex-direction: column; align-items: center; padding: 2rem; text-align: center; }
.empty-state img  { width: 3rem; height: 3rem; opacity: 0.25; margin-bottom: 0.75rem; filter: brightness(0) invert(1); }
.empty-state p    { color: #475569; font-size: 0.85rem; font-weight: 600; }
.empty-state span { color: #334155; font-size: 0.75rem; margin-top: 0.25rem; }

/* ── Toast ── */
.toast-wrap {
  position: fixed; top: 6rem; left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; flex-direction: column; gap: 0.4rem;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 0.7rem 1.1rem; border-radius: 0.75rem; font-size: 0.82rem; font-weight: 700;
  border: 1px solid; min-width: 15rem; max-width: 24rem; text-align: center;
  backdrop-filter: blur(12px); pointer-events: auto;
  animation: dropDown 0.4s cubic-bezier(0.16,1,0.3,1); box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.toast.positive { background: rgba(34,197,94,0.15); color: #4ade80; border-color: rgba(34,197,94,0.3); }
.toast.negative { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }
.toast.warning  { background: rgba(234,179,8,0.15);  color: #facc15; border-color: rgba(234,179,8,0.3); }

/* ── Refresh button ── */
.refresh-btn {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.68rem; font-weight: 600; color: #475569; cursor: pointer;
  background: none; border: none; font-family: inherit;
  transition: color 0.2s; padding: 0.25rem 0.5rem; border-radius: 0.5rem;
}
.refresh-btn:hover   { color: #94a3b8; background: rgba(255,255,255,0.04); }
.refresh-btn.spinning{ animation: spin 1s linear infinite; }

/* ── Index page specific ── */
.welcome-banner {
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 2.5rem 2rem;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  max-width: 1100px; margin: 0 auto;
  animation: fadeUp 0.5s ease both;
}
.welcome-text         { flex: 1; min-width: 260px; }
.welcome-text h1      { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.5rem; }
.welcome-text h1 span { color: #60a5fa; }
.welcome-text p       { font-size: 0.85rem; color: #64748b; line-height: 1.65; max-width: 520px; }
.welcome-text p a     { color: #60a5fa; text-decoration: none; }
.welcome-text p a:hover { text-decoration: underline; }

.stats-bar {
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center;
  padding: 0.75rem 2rem; gap: 2rem; flex-wrap: wrap;
  max-width: 1100px; margin: 0 auto;
  animation: fadeUp 0.5s 0.1s ease both;
}
.stat-item  { display: flex; align-items: baseline; gap: 0.35rem; }
.stat-num   { font-size: 0.9rem; font-weight: 800; color: white; }
.stat-label { font-size: 0.8rem; color: #475569; }

.notice-bar { max-width: 1100px; margin: 1rem auto 0; padding: 0 2rem; animation: fadeUp 0.4s ease both; }
.notice {
  display: inline-block; padding: 0.5rem 1rem;
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2);
  color: #93c5fd; border-radius: 0.375rem; font-size: 0.8rem;
}

.main-layout { max-width: 1100px; margin: 0 auto; padding: 2rem 2rem 4rem; animation: fadeUp 0.5s 0.15s ease both; }

.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding-bottom: 0.6rem; margin-bottom: 0;
}
.section-header h2   { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: #475569; }
.section-header span { font-size: 0.7rem; color: #334155; }

/* Book list (index page vertical RYM-style) */
.book-list { display: flex; flex-direction: column; }
.book-row  {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.15s;
}
.book-row:hover { background: rgba(255,255,255,0.02); }
.book-num  { font-size: 1rem; font-weight: 800; color: #1e3a5f; width: 1.5rem; text-align: right; flex-shrink: 0; }
.book-cover {
  width: 60px; height: 80px; flex-shrink: 0;
  border-radius: 0.25rem; overflow: hidden;
  border: 1px solid rgba(71,85,105,0.4);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.book-cover img      { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-info           { flex: 1; min-width: 0; }
.book-title-link     { font-size: 1rem; font-weight: 700; color: white; text-decoration: none; display: block; margin-bottom: 0.2rem; line-height: 1.3; }
.book-title-link:hover  { color: #93c5fd; }
.book-author-link    { font-size: 0.85rem; font-weight: 600; color: #60a5fa; text-decoration: none; display: block; margin-bottom: 0.25rem; }
.book-author-link:hover { color: #93c5fd; }
.book-meta           { font-size: 0.75rem; color: #475569; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.book-shelf          { font-size: 0.7rem; font-weight: 600; color: #1d4ed8; letter-spacing: 0.04em; }
.book-isbn-meta      { color: #334155; }
.book-status {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.25rem 0.65rem; border-radius: 9999px; border: 1px solid;
}
.status-available { color: #4ade80; background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.25); }
.status-out       { color: #f87171; background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.25); }

/* CTA block (index logged-out) */
.cta-block {
  margin-top: 2.5rem; padding: 1.5rem;
  background: rgba(29,78,216,0.07); border: 1px solid rgba(59,130,246,0.15);
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.cta-block p        { font-size: 0.85rem; color: #64748b; }
.cta-block p strong { color: white; }
.cta-btn {
  padding: 0.5rem 1.25rem; border-radius: 9999px;
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
  text-decoration: none; border: 1px solid rgba(59,130,246,0.5);
  color: #60a5fa; background: rgba(59,130,246,0.1);
  transition: all 0.2s; white-space: nowrap;
}
.cta-btn:hover { background: rgba(59,130,246,0.25); }

/* ── Footer ── */
footer {
  position: relative; z-index: 1; width: 100%;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 1.25rem 2rem; margin-top: 2rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
  font-size: 0.72rem; color: #334155;
}

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3b82f6; }

/* ── Responsive ── */
@media (max-width: 768px) {
  ::-webkit-scrollbar { display: none; }
  * { scrollbar-width: none; }
}
@media (max-width: 640px) {
  .top-header { padding: 0 1rem; gap: 0.75rem; }
  .header-nav  { display: none; }
  .header-right .header-user-name { display: none; }
  .hamburger   { display: flex; }
  .book-modal-layout { grid-template-columns: 1fr; }
  .book-modal-content { padding: 0.4rem 1rem 1.2rem; }
  .welcome-banner { padding: 1.5rem 1rem; gap: 1rem; }
  .stats-bar   { padding: 0.75rem 1rem; gap: 1rem; }
  .main-layout { padding: 1.5rem 1rem 3rem; }
  .book-num    { display: none; }
  footer       { justify-content: center; text-align: center; }
}
