/* =========================================================
   QUAN LY THU VIEN — SCI-FI THEME
   Dark navy / purple / neon-blue control-room aesthetic
   ========================================================= */

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

:root {
  --bg-void:        #05060d;
  --bg-deep:        #090b16;
  --bg-panel:       rgba(18, 22, 41, 0.72);
  --bg-panel-solid: #12162a;
  --bg-panel-hover: rgba(28, 33, 58, 0.85);

  --neon-blue:    #3fa9ff;
  --neon-blue-2:  #00e5ff;
  --neon-purple:  #a855f7;
  --neon-purple-2:#7c3aed;
  --neon-pink:    #ff4fd8;

  --text-main:    #dce6f7;
  --text-muted:   #8891ad;
  --text-dim:     #8f9bc4;

  --border-glow:  rgba(63, 169, 255, 0.35);
  --border-soft:  rgba(120, 140, 200, 0.16);

  --danger: #ff3b6b;
  --warning: #ffb020;
  --success: #22e6a8;
  --info: #3fc7ff;

  --radius: 14px;
  --font-head: 'Orbitron', 'Segoe UI', sans-serif;
  --font-body: 'Rajdhani', 'Segoe UI', sans-serif;
}

html {
  font-size: 15px;
}

@media (min-width: 768px) {
  html { font-size: 16px; }
}

html, body {
  position: relative;
  min-height: 100%;
  background: var(--bg-void);
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.01em;
}

body {
  margin-bottom: 70px;
  min-height: 100vh;
  overflow-x: hidden;
  /* Phải trong suốt: nếu body có nền đặc thì nó sẽ che mất lớp nền (body::before, z-index âm) chứa ảnh thư viện.
     Màu nền dự phòng vẫn do thẻ html đảm nhiệm ở trên. */
  background: transparent;
}

/* ---------- Sci-fi animated background ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(ellipse 60% 45% at 12% 8%, rgba(124, 58, 237, 0.35), transparent 60%),
    radial-gradient(ellipse 55% 50% at 90% 12%, rgba(63, 169, 255, 0.28), transparent 60%),
    radial-gradient(ellipse 70% 55% at 50% 100%, rgba(0, 229, 255, 0.14), transparent 65%),
    linear-gradient(180deg, rgba(5, 6, 13, 0.80) 0%, rgba(10, 13, 28, 0.72) 45%, rgba(12, 10, 30, 0.84) 100%),
    url('../images/library-bg.jpg') center / cover no-repeat,
    #05060d;
  background-attachment: fixed;
  /* Ảnh gốc nhỏ (554px) nên làm mờ nhẹ + phóng to chút để không bị vỡ hạt khi kéo giãn toàn màn hình */
  filter: blur(2px);
  transform: scale(1.04);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(63, 169, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 169, 255, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, #000 10%, transparent 75%);
  animation: gridDrift 40s linear infinite;
}

@keyframes gridDrift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 42px 84px, 42px 84px; }
}

/* Floating glow particles */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.starfield span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--neon-blue-2);
  box-shadow: 0 0 8px 2px rgba(0, 229, 255, 0.8);
  opacity: 0.7;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.5; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  color: #eef4ff;
  letter-spacing: 0.03em;
}

h1 {
  font-size: 1.65rem;
  font-weight: 700;
  padding-bottom: 0.6rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-shadow: 0 0 18px rgba(63, 169, 255, 0.35);
}
h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 90px; height: 2px;
  background: linear-gradient(90deg, var(--neon-blue-2), var(--neon-purple));
  box-shadow: 0 0 10px var(--neon-blue-2);
}
h1 > i.bi, h1 > svg { color: var(--neon-blue-2); filter: drop-shadow(0 0 6px rgba(0,229,255,.6)); }

h3 { font-size: 1.15rem; font-weight: 600; }

a { color: var(--neon-blue-2); text-decoration: none; }
a:hover { color: var(--neon-purple); text-shadow: 0 0 8px rgba(168, 85, 247, .5); }

.text-muted { color: var(--text-muted) !important; }

/* ---------- Layout shell ---------- */
.container, .container-fluid.page-shell {
  position: relative;
  z-index: 1;
}

main.pb-3 {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 2rem 2rem 2.5rem;
  margin-top: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.02) inset, 0 20px 60px rgba(0,0,0,0.45);
}

/* ---------- Navbar ---------- */
header nav.navbar {
  background: linear-gradient(180deg, rgba(9, 11, 22, 0.95), rgba(9, 11, 22, 0.85)) !important;
  border-bottom: 1px solid var(--border-glow) !important;
  box-shadow: 0 2px 30px rgba(63, 169, 255, 0.12), 0 1px 0 rgba(168,85,247,0.25);
  backdrop-filter: blur(14px);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.navbar-brand {
  font-family: var(--font-head) !important;
  font-weight: 800 !important;
  font-size: 1.15rem !important;
  color: #fff !important;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.navbar-brand .bi {
  color: var(--neon-blue-2);
  font-size: 1.4rem;
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.85));
  animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(0,229,255,.6)); }
  50% { filter: drop-shadow(0 0 14px rgba(168,85,247,.85)); }
}

.navbar-nav .nav-link {
  color: var(--text-main) !important;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.95rem !important;
  margin: 0 0.1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  position: relative;
}
.navbar-nav .nav-link .bi { font-size: 1.05rem; color: var(--neon-blue); }
.navbar-nav .nav-link:hover {
  color: #fff !important;
  background: rgba(63, 169, 255, 0.12);
  box-shadow: 0 0 16px rgba(63, 169, 255, 0.25) inset;
}
.navbar-nav .nav-link:hover .bi { color: var(--neon-blue-2); }
.navbar-nav .nav-link.active-link {
  background: linear-gradient(90deg, rgba(63,169,255,0.18), rgba(168,85,247,0.18));
  color: #fff !important;
}

/* Nút "Đăng xuất" là <button> trong <form> nhưng cần trông y hệt các .nav-link khác */
.navbar-nav .nav-link-btn {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
}

.navbar-toggler {
  border-color: var(--border-glow) !important;
}
.navbar-toggler-icon {
  filter: invert(1) drop-shadow(0 0 4px rgba(63,169,255,.8));
}

/* ---------- Footer ---------- */
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 55px;
  background: rgba(9, 11, 22, 0.9);
  border-top: 1px solid var(--border-glow) !important;
  color: var(--text-dim) !important;
  font-family: var(--font-body);
  letter-spacing: 0.03em;
  backdrop-filter: blur(10px);
}
.footer a { color: var(--neon-blue); }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-main);
  box-shadow: 0 8px 26px rgba(0,0,0,0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(63,169,255,0.35), rgba(168,85,247,0.25), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(63,169,255,0.18), 0 0 0 1px rgba(63,169,255,0.25);
}
.card-body h2 {
  font-size: 1.9rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--neon-blue-2), var(--neon-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.card.border-danger { border-color: rgba(255,59,107,0.5) !important; }
.card.border-danger .card-body h2 { -webkit-text-fill-color: var(--danger); background: none; }
.card.border-warning { border-color: rgba(255,176,32,0.5) !important; }
.card.border-warning .card-body h2 { -webkit-text-fill-color: var(--warning); background: none; }

.card-header {
  background: rgba(63, 169, 255, 0.08);
  border-bottom: 1px solid var(--border-glow);
  color: #eef4ff;
  font-weight: 600;
  font-family: var(--font-head);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.stat-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(63,169,255,0.18), rgba(168,85,247,0.18));
  color: var(--neon-blue-2);
  font-size: 1.35rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 0 18px rgba(63,169,255,0.25);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.btn .bi { font-size: 1rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-purple-2) 100%);
  border: none;
  color: #fff;
  box-shadow: 0 0 18px rgba(63,169,255,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--neon-blue-2) 0%, var(--neon-purple) 100%);
  box-shadow: 0 0 26px rgba(168,85,247,0.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(120,140,200,0.12);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
}
.btn-secondary:hover { background: rgba(120,140,200,0.22); color: #fff; }

.btn-outline-primary {
  border: 1px solid var(--neon-blue);
  color: var(--neon-blue-2);
  background: transparent;
}
.btn-outline-primary:hover {
  background: rgba(63,169,255,0.15);
  border-color: var(--neon-blue-2);
  color: #fff;
  box-shadow: 0 0 14px rgba(63,169,255,0.35);
}

.btn-outline-secondary {
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  background: transparent;
}
.btn-outline-secondary:hover { color: #fff; background: rgba(120,140,200,0.15); }

.btn-outline-danger { border-color: rgba(255,59,107,0.6); color: #ff7391; background: transparent; }
.btn-outline-danger:hover { background: rgba(255,59,107,0.15); color: #fff; box-shadow: 0 0 14px rgba(255,59,107,0.35); }

.btn-outline-warning { border-color: rgba(255,176,32,0.6); color: var(--warning); background: transparent; }
.btn-outline-warning:hover { background: rgba(255,176,32,0.15); color: #fff; box-shadow: 0 0 14px rgba(255,176,32,0.35); }

.btn-danger {
  background: linear-gradient(135deg, #ff3b6b, #c2185b);
  border: none; color: #fff;
  box-shadow: 0 0 16px rgba(255,59,107,0.4);
}
.btn-danger:hover { box-shadow: 0 0 24px rgba(255,59,107,0.6); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #22e6a8, #0ea678);
  border: none; color: #06231a;
  box-shadow: 0 0 16px rgba(34,230,168,0.4);
}
.btn-success:hover { box-shadow: 0 0 24px rgba(34,230,168,0.6); transform: translateY(-1px); }

.btn-warning {
  background: linear-gradient(135deg, #ffb020, #ff7a00);
  border: none; color: #2a1400;
  box-shadow: 0 0 16px rgba(255,176,32,0.4);
}

.btn-info {
  background: linear-gradient(135deg, #3fc7ff, #3fa9ff);
  border: none; color: #04202e;
  box-shadow: 0 0 16px rgba(63,199,255,0.4);
}

.btn-sm { font-size: 0.82rem; padding: 0.32rem 0.7rem; }

/* ---------- Tables ---------- */
.table {
  color: var(--text-main);
  border-color: var(--border-soft);
  background: rgba(255,255,255,0.01);
  border-radius: 10px;
  overflow: hidden;
}
.table thead th {
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neon-blue-2);
  background: rgba(63, 169, 255, 0.08);
  border-bottom: 1px solid var(--border-glow) !important;
  border-top: none;
  padding: 0.85rem 0.75rem;
}
.table td { border-color: var(--border-soft); padding: 0.7rem 0.75rem; vertical-align: middle; }

/* Every row gets a solid-ish backdrop so text never sits directly on the
   animated page background (that's what was washing text out / "chìm màu"). */
.table > :not(caption) > * > * { background-color: rgba(10, 12, 24, 0.55); }

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(63, 169, 255, 0.10);
  color: var(--text-main);
}
.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: rgba(10, 12, 24, 0.55);
  color: var(--text-main);
}
.table-bordered { border: 1px solid var(--border-soft); }
.table-hover > tbody > tr:hover > * {
  background-color: rgba(168, 85, 247, 0.16);
}
.table-sm td, .table-sm th { padding: 0.5rem 0.6rem; }

/* ---------- Pagination ---------- */
.pagination { gap: 0.35rem; margin-top: 1.25rem; }
.pagination .page-link {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  border-radius: 6px;
  font-weight: 600;
}
.pagination .page-link:hover {
  background: rgba(63, 169, 255, 0.16);
  color: var(--neon-blue-2);
  border-color: var(--border-glow);
}
.pagination .page-item.active .page-link {
  background: var(--neon-blue-2);
  border-color: var(--neon-blue-2);
  color: #06121f;
  box-shadow: 0 0 10px rgba(63, 169, 255, 0.4);
}
.pagination .page-item.disabled .page-link {
  background: rgba(255,255,255,0.02);
  color: var(--text-muted, #6b7a90);
  border-color: var(--border-soft);
}

/* ---------- Badges ---------- */
.badge {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.42em 0.75em;
  border-radius: 7px;
}
.badge.bg-success { background: rgba(34,230,168,0.18) !important; color: #4dffcf !important; box-shadow: 0 0 10px rgba(34,230,168,0.3) inset; border: 1px solid rgba(34,230,168,0.4); }
.badge.bg-primary { background: rgba(63,169,255,0.18) !important; color: #7fd0ff !important; box-shadow: 0 0 10px rgba(63,169,255,0.3) inset; border: 1px solid rgba(63,169,255,0.4); }
.badge.bg-danger { background: rgba(255,59,107,0.18) !important; color: #ff8fa8 !important; box-shadow: 0 0 10px rgba(255,59,107,0.3) inset; border: 1px solid rgba(255,59,107,0.4); }
.badge.bg-warning { background: rgba(255,176,32,0.18) !important; color: #ffcf70 !important; box-shadow: 0 0 10px rgba(255,176,32,0.3) inset; border: 1px solid rgba(255,176,32,0.4); }
.badge.bg-dark { background: rgba(120,140,200,0.18) !important; color: #b6c0e0 !important; border: 1px solid rgba(120,140,200,0.4); }
.badge.bg-secondary { background: rgba(120,140,200,0.18) !important; color: #b6c0e0 !important; border: 1px solid rgba(120,140,200,0.4); }
.badge.text-dark { color: #ffcf70 !important; }

/* ---------- Alerts ---------- */
.alert { border-radius: 10px; border: 1px solid; backdrop-filter: blur(6px); font-weight: 500; }
.alert-danger { background: rgba(255,59,107,0.1); border-color: rgba(255,59,107,0.4); color: #ff9cb2; }
.alert-warning { background: rgba(255,176,32,0.1); border-color: rgba(255,176,32,0.4); color: #ffd489; }

/* ---------- Forms ---------- */
.form-control, .form-select {
  background: rgba(8, 10, 20, 0.65);
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
}
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus, .form-select:focus {
  background: rgba(8, 10, 20, 0.85);
  border-color: var(--neon-blue);
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(63, 169, 255, 0.25) !important;
}
.form-control:disabled, .form-control[readonly] {
  background: rgba(120,140,200,0.06);
  color: var(--text-dim);
}
.form-select option { background: var(--bg-panel-solid); color: var(--text-main); }
label.control-label, .form-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.form-check-input {
  background-color: rgba(8,10,20,0.7);
  border: 1px solid var(--border-glow);
}
.form-check-input:checked {
  background-color: var(--neon-blue);
  border-color: var(--neon-blue);
}
.form-check-label { color: var(--text-main); }
.text-danger { color: #ff7391 !important; }

dl.row dt {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
dl.row dd { color: var(--text-main); font-weight: 500; }

hr { border-color: var(--border-soft); opacity: 1; }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.15rem rgba(5,6,13,0.9), 0 0 0 0.32rem var(--neon-blue-2) !important;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--text-dim);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-void); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neon-blue), var(--neon-purple));
  border-radius: 6px;
}

/* ---------- Book cover images ---------- */
.book-cover-thumb {
  width: 96px;
  height: 134px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 10px rgba(63, 169, 255, 0.25);
  background: var(--bg-panel-solid);
}

.book-cover-lg {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 24px rgba(63, 169, 255, 0.3), 0 10px 30px rgba(0,0,0,0.5);
  background: var(--bg-panel-solid);
}

.book-cover-frame {
  display: inline-flex;
  padding: 8px;
  border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(160deg, rgba(63,169,255,0.12), rgba(168,85,247,0.12));
  border: 1px solid var(--border-soft);
}

.book-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-blue);
  background: var(--bg-panel-solid);
  border: 1px dashed var(--border-glow);
}
.book-cover-placeholder.book-cover-thumb { font-size: 2.2rem; }
.book-cover-placeholder.book-cover-lg { font-size: 3.5rem; }

.image-url-preview-wrap {
  margin-top: 0.6rem;
}

/* Page section icon chip used inline in headings/buttons */
.icon-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.9rem; border-radius: 8px;
  background: rgba(63,169,255,0.12);
  color: var(--neon-blue-2);
  font-size: 1rem;
}

/* ---------- Auth pages (Login/Register) ---------- */
.auth-card {
  max-width: 460px;
  margin: 0 auto;
  padding: 1.75rem;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.1rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

.btn-google, .btn-facebook {
  width: 100%;
  justify-content: center;
  font-weight: 600;
}
.btn-google {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid var(--border-soft);
}
.btn-google:hover { background: #f2f2f2; color: #1f1f1f; }
.btn-facebook {
  background: #1877f2;
  color: #fff;
  border: none;
  box-shadow: 0 0 16px rgba(24,119,242,0.35);
}
.btn-facebook:hover { background: #1465d1; color: #fff; }

/* ---------- Profile page ---------- */
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-glow);
  box-shadow: 0 0 24px rgba(63, 169, 255, 0.3);
  background: var(--bg-panel-solid);
}
.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--neon-blue);
}

/* ---------- Trang chủ độc giả ---------- */
.hero { padding: 2.5rem 1rem 1.5rem; }
.hero-search { display: flex; gap: .5rem; max-width: 640px; margin: 0 auto; }
.book-tile { transition: transform .2s ease; }
.book-tile:hover { transform: translateY(-4px); }
.book-tile-cover { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.book-tile-placeholder { display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--neon-blue); background: var(--bg-panel-solid); }

/* ---------- Trang chủ: dropdown thể loại ---------- */
.hero-search .genre-dropdown { flex: 0 0 auto; }
.genre-menu {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,.6), 0 0 18px rgba(63,169,255,.18);
  max-height: 320px;
  overflow-y: auto;
  padding: .4rem;
}
.genre-menu .dropdown-item { color: var(--text-main); border-radius: 8px; padding: .45rem .8rem; }
.genre-menu .dropdown-item:hover,
.genre-menu .dropdown-item:focus { background: rgba(63,169,255,.16); color: var(--neon-blue-2); }
.genre-menu .dropdown-divider { border-color: var(--border-soft); }

/* ---------- Trang chủ: slide Sách hot ---------- */
.hot-carousel {
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, rgba(124,58,237,.28), rgba(63,169,255,.14) 60%, rgba(10,13,28,.9));
  box-shadow: 0 0 24px rgba(63,169,255,.15);
}
.hot-slide { display: flex; align-items: center; gap: 1.5rem; padding: 1.5rem 3.5rem 2.5rem; min-height: 320px; }
.hot-cover-wrap { flex: 0 0 auto; }
.hot-cover {
  width: 170px; height: 245px; object-fit: cover; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.6), 0 0 20px rgba(168,85,247,.35);
}
.hot-cover-placeholder { display: flex; align-items: center; justify-content: center; font-size: 3rem; color: var(--neon-blue); background: var(--bg-panel-solid); }
.hot-info { min-width: 0; }
.hot-tag {
  display: inline-block; font-family: var(--font-head); font-size: .7rem; letter-spacing: .12em;
  color: #fff; background: linear-gradient(90deg, var(--danger), var(--neon-purple));
  padding: .2rem .7rem; border-radius: 999px; margin-bottom: .6rem;
}
.hot-title { font-family: var(--font-head); font-size: 1.5rem; color: var(--text-main); margin-bottom: .3rem; }
.hot-carousel .carousel-control-prev, .hot-carousel .carousel-control-next { width: 3rem; opacity: .75; }
.hot-carousel .carousel-indicators { margin-bottom: .6rem; }
.hot-carousel .carousel-indicators [data-bs-target] { width: 26px; height: 4px; border-radius: 4px; background: var(--neon-blue-2); }

@media (max-width: 575.98px) {
  .hot-slide { flex-direction: column; text-align: center; padding: 1.2rem 2.8rem 2.5rem; }
  .hot-cover { width: 130px; height: 190px; }
}

/* ---------- Trang chủ: bảng xếp hạng ---------- */
.rank-card { min-height: 320px; }
.rank-row {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 10px;
  color: var(--text-main); transition: background .15s ease;
}
.rank-row:hover { background: rgba(63,169,255,.12); color: var(--text-main); text-shadow: none; }
.rank-num {
  flex: 0 0 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: .8rem; font-weight: 700; background: var(--bg-panel-solid);
  border: 1px solid var(--border-soft); color: var(--text-dim);
}
.rank-num.rank-1 { background: #ffb020; color: #1a1200; border-color: #ffb020; box-shadow: 0 0 10px rgba(255,176,32,.6); }
.rank-num.rank-2 { background: #cfd8e6; color: #11151f; border-color: #cfd8e6; }
.rank-num.rank-3 { background: #d98a4e; color: #1d0e02; border-color: #d98a4e; }
.rank-thumb { flex: 0 0 38px; width: 38px; height: 54px; object-fit: cover; border-radius: 5px; background: var(--bg-panel-solid); }
.rank-thumb-ph { display: flex; align-items: center; justify-content: center; color: var(--neon-blue); }
.rank-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.rank-title { font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-sub { font-size: .8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-count { flex: 0 0 auto; font-size: .85rem; color: var(--neon-blue-2); white-space: nowrap; }

/* ---------- Trang chủ: sách mới nhập ---------- */
.new-ribbon {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--font-head); font-size: .6rem; letter-spacing: .1em; color: #04141a;
  background: var(--neon-blue-2); padding: .2rem .55rem; border-radius: 999px;
  box-shadow: 0 0 12px rgba(0,229,255,.7);
}

/* ---------- Chi tiết sách: đánh giá sao, thích/không thích, bình luận ---------- */
.fb-section { border-top: 1px solid var(--border-soft); padding-top: 1.5rem; }
.fb-summary { padding: 1rem 1.25rem; border: 1px solid var(--border-soft); border-radius: var(--radius); background: rgba(9,11,22,.5); }
.rating-big { font-family: var(--font-head); font-size: 2.4rem; line-height: 1; color: #fff; }
.stars { color: var(--warning); letter-spacing: .1em; }
.react-btn {
  border: 1px solid var(--border-soft); color: var(--text-main); background: rgba(18,22,41,.8);
  border-radius: 999px; padding: .4rem 1rem;
}
.react-btn:hover { border-color: var(--neon-blue); color: var(--neon-blue-2); }
.react-btn.disabled { opacity: .6; }
.react-count { margin-left: .25rem; font-weight: 700; }
.react-like-on { border-color: var(--success); color: var(--success); background: rgba(34,230,168,.12); }
.react-dislike-on { border-color: var(--danger); color: var(--danger); background: rgba(255,59,107,.12); }

.fb-form { padding: 1rem 1.25rem; border: 1px solid var(--border-soft); border-radius: var(--radius); background: rgba(9,11,22,.5); }
/* Chọn sao bằng radio: DOM xếp 5->1 và đảo chiều hiển thị, nên chọn sao k thì các sao nhỏ hơn k (đứng sau trong DOM) cũng sáng */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: .15rem; }
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label { font-size: 1.9rem; color: #3b4263; cursor: pointer; transition: color .1s ease; margin: 0; }
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: var(--warning); }
.star-input input:focus-visible + label { outline: 2px solid var(--neon-blue); border-radius: 4px; }

.review-item { padding: .9rem 0; border-bottom: 1px solid var(--border-soft); }
.review-text { margin-top: .4rem; white-space: pre-line; word-break: break-word; }

/* ---------- Giao diện quản trị: đổi tông màu sang cam để phân biệt với trang độc giả ---------- */
body.admin-theme {
  --neon-blue: #ff9f43;
  --neon-blue-2: #ffc371;
  --neon-purple: #ff6b6b;
  --border-glow: rgba(255, 159, 67, 0.4);
}
.admin-badge {
  font-size: .6rem; font-weight: 800; letter-spacing: .12em;
  padding: .2em .55em; border-radius: 6px; margin-left: .4rem; vertical-align: middle;
  background: rgba(255,159,67,.18); color: #ffc371; border: 1px solid rgba(255,159,67,.5);
}

/* ---------- Sửa chữ tối bị "chìm" trên nền đen ----------
   Nguyên nhân: Bootstrap mặc định dùng màu chữ #212529 (gần đen) cho bảng, form-text, alert-success...
   Đổi biến gốc của Bootstrap sang màu sáng để mọi thành phần dùng biến đó đều đọc được. */
:root, [data-bs-theme="light"] {
  --bs-body-color: #dce6f7;
  --bs-body-color-rgb: 220, 230, 247;
  --bs-emphasis-color: #ffffff;
  --bs-emphasis-color-rgb: 255, 255, 255;
  --bs-secondary-color: #9aa5c7;
  --bs-tertiary-color: #8f9bc4;
  --bs-heading-color: #eef4ff;
  --bs-border-color: rgba(120, 140, 200, 0.16);
}

/* Bảng: mọi ô đều chữ sáng (trước đây chỉ bảng table-striped được đặt màu nên bảng table-bordered
   như danh sách đầu sách bị chữ đen, ví dụ số kiểm soát 001) */
.table {
  --bs-table-color: var(--text-main);
  --bs-table-striped-color: var(--text-main);
  --bs-table-hover-color: #ffffff;
  --bs-table-border-color: var(--border-soft);
}
.table > :not(caption) > * > * { color: var(--text-main); }
.table-hover > tbody > tr:hover > * { color: #ffffff; }

/* Các lớp chữ tối của Bootstrap -> chữ sáng */
.text-dark, .text-black, .link-dark, .text-body, .text-body-emphasis { color: var(--text-main) !important; }
.form-text, .text-body-secondary, .text-secondary { color: #9aa5c7 !important; }

/* Alert chưa được tô theme: nền nhạt + chữ tối của Bootstrap rất lệch với nền đen */
.alert-success { background: rgba(34,230,168,0.1); border-color: rgba(34,230,168,0.4); color: #7dffd6; }
.alert-info { background: rgba(63,199,255,0.1); border-color: rgba(63,199,255,0.4); color: #9fe3ff; }
.alert-secondary { background: rgba(120,140,200,0.1); border-color: rgba(120,140,200,0.35); color: #c5cdea; }
.alert-link { color: inherit; text-decoration: underline; }

/* ---------- Giới thiệu / tóm tắt nội dung sách ---------- */
.book-summary {
  white-space: pre-line;           /* giữ xuống dòng admin đã nhập */
  line-height: 1.7;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--neon-blue);
  border-radius: var(--radius);
  background: rgba(9, 11, 22, 0.5);
}

/* =========================================================
   GIAO DIỆN ĐIỆN THOẠI (màn hình < 768px)
   Một bộ HTML dùng chung: trình duyệt tự chọn bố cục theo chiều rộng màn hình,
   laptop/PC (>= 768px) giữ nguyên giao diện cũ, không bị ảnh hưởng.
   ========================================================= */

/* Thanh điều hướng dưới đáy: chỉ có trên điện thoại */
.mobile-tabbar { display: none; }

@media (max-width: 767.98px) {
  /* --- Hiệu năng/pin: bỏ hiệu ứng nặng, iOS lỗi với background-attachment: fixed --- */
  body::before { filter: none; transform: none; background-attachment: scroll; }
  body::after, .starfield { display: none; }
  .navbar-brand .bi { animation: none; }

  /* --- Khung trang gọn lại, tận dụng bề ngang --- */
  html { font-size: 15px; }
  body { margin-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .container { padding-left: .6rem; padding-right: .6rem; }
  main.pb-3 { padding: 1rem .9rem 1.5rem; margin-top: .6rem; border-radius: 12px; }
  h1 { font-size: 1.25rem; margin-bottom: 1rem; flex-wrap: wrap; }
  h1::after { width: 64px; }
  h3 { font-size: 1.05rem; }
  .footer { display: none; }                     /* đã có thanh dưới đáy */

  /* --- Navbar trên: chỉ logo + nút menu --- */
  header nav.navbar { padding-top: .4rem; padding-bottom: .4rem; }
  .navbar-brand { font-size: 1rem !important; }
  .navbar-nav .nav-link { padding: .75rem .9rem !important; font-size: 1rem; }

  /* --- Dễ chạm: nút/ô nhập đủ lớn, ô nhập >= 16px để iPhone không tự phóng to --- */
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
  .btn-sm { min-height: 38px; }
  .form-control, .form-select { font-size: 16px; min-height: 44px; }
  textarea.form-control { min-height: 0; }
  .form-check-input { width: 1.25em; height: 1.25em; }

  /* --- Form: nút Lưu/Hủy dàn hàng ngang, dễ bấm --- */
  form .btn + .btn { margin-left: .25rem; }

  /* --- Trang chủ --- */
  .hero { padding: 1rem 0 .5rem; }
  .hero-search { flex-wrap: wrap; }
  .hero-search .form-control { flex: 1 1 100%; order: 1; }
  .hero-search .genre-dropdown { flex: 1 1 calc(50% - .25rem); order: 2; }
  .hero-search .genre-dropdown .btn { width: 100%; }
  .hero-search > .btn-primary { flex: 1 1 calc(50% - .25rem); order: 3; }
  .rank-card { min-height: 0; }

  /* --- Tra cứu sách: lưới 2 cột gọn --- */
  .book-tile .card-body { padding: .6rem; }
  .book-tile .fw-bold { font-size: .92rem; line-height: 1.25; }

  /* --- Chi tiết sách: bìa ở giữa, nút bấm full ngang --- */
  .row.g-4 > .col-auto { width: 100%; text-align: center; }
  .book-cover-lg { max-width: 190px; }
  .row > .col > .d-flex.flex-wrap.gap-2 > form,
  .row > .col > .d-flex.flex-wrap.gap-2 > a,
  .row > .col > .d-flex.flex-wrap.gap-2 > button { flex: 1 1 100%; }
  .row > .col > .d-flex.flex-wrap.gap-2 .btn { width: 100%; }
  .book-summary { padding: .8rem .9rem; }
  .fb-summary { padding: .8rem; }
  dl.row dt { margin-top: .4rem; color: var(--text-dim); font-weight: 600; }

  /* --- Phân trang: cuộn ngang thay vì rớt dòng lộn xộn --- */
  .pagination { flex-wrap: nowrap !important; justify-content: flex-start !important; overflow-x: auto; padding-bottom: .3rem; }
  .pagination .page-link { min-width: 40px; text-align: center; padding: .55rem .7rem; }

  /* --- BẢNG -> THẺ: mỗi dòng là 1 thẻ, mỗi ô là "Nhãn: giá trị" (nhãn do site.js gắn tự động) --- */
  table.table.table-cards { border: 0; background: transparent; }
  table.table.table-cards thead { display: none; }
  table.table.table-cards,
  table.table.table-cards tbody,
  table.table.table-cards tr,
  table.table.table-cards td { display: block; width: 100%; }
  table.table.table-cards tr {
    margin-bottom: .75rem; border: 1px solid var(--border-soft); border-radius: 12px;
    background: rgba(10, 12, 24, 0.7); overflow: hidden;
  }
  table.table.table-cards td {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    text-align: right; padding: .55rem .8rem; border: 0; border-bottom: 1px solid var(--border-soft);
    background: transparent !important; word-break: break-word;
  }
  table.table.table-cards td:last-child { border-bottom: 0; }
  table.table.table-cards td::before {
    content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 700;
  }
  table.table.table-cards td[data-label=""]::before { display: none; }
  /* Cột thao tác (nút) dàn đều ngang */
  table.table.table-cards td[data-label=""] { justify-content: stretch; flex-wrap: wrap; text-align: left; }
  table.table.table-cards td[data-label=""] > *, table.table.table-cards td[data-label=""] form { flex: 1 1 auto; }
  table.table.table-cards td[data-label=""] .btn { width: 100%; }
  .table-responsive:has(table.table-cards) { overflow: visible; }

  /* --- Admin: bảng thống kê/dashboard --- */
  .admin-theme .row.g-3 > [class*="col-"] { margin-bottom: .25rem; }

  /* --- Thanh điều hướng dưới đáy --- */
  .mobile-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(9, 11, 22, 0.94), rgba(7, 9, 18, 0.98));
    border-top: 1px solid var(--border-glow);
    box-shadow: 0 -6px 30px rgba(63, 169, 255, 0.14);
    backdrop-filter: blur(14px);
  }
  .mobile-tabbar a {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: .35rem .1rem; border-radius: 10px; min-height: 52px;
    color: var(--text-dim); font-size: .68rem; font-weight: 600; line-height: 1.1; text-align: center;
  }
  .mobile-tabbar a .bi { font-size: 1.3rem; color: var(--text-dim); }
  .mobile-tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-tabbar a:hover { text-shadow: none; }
  .mobile-tabbar a.active { color: #fff; background: linear-gradient(180deg, rgba(63,169,255,.18), rgba(168,85,247,.18)); }
  .mobile-tabbar a.active .bi { color: var(--neon-blue-2); filter: drop-shadow(0 0 6px rgba(0,229,255,.7)); }
}

/* Điện thoại nhỏ (iPhone SE, Android nhỏ...) */
@media (max-width: 380px) {
  html { font-size: 14px; }
  main.pb-3 { padding: .8rem .7rem 1.2rem; }
  .mobile-tabbar a { font-size: .62rem; }
}

/* Người dùng bật "giảm chuyển động" trong hệ điều hành */
@media (prefers-reduced-motion: reduce) {
  body::after, .starfield span, .navbar-brand .bi { animation: none !important; }
  .carousel-item { transition: none !important; }
}


/* =========================================================
   HIỆU ỨNG MỞ SÁCH + HIỆU ỨNG PHỤ
   ========================================================= */

/* ----- Lớp phủ lúc bấm vào sách (do site.js tạo ra) ----- */
.bfx-root { position: fixed; inset: 0; z-index: 20001; overflow: hidden; }
.bfx-backdrop {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(10,13,28,.82), rgba(3,4,10,.95));
  backdrop-filter: blur(6px);
}
.bfx { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.bfx-book { position: absolute; inset: 0; perspective: 1500px; perspective-origin: 0% 50%; }
.bfx-pages, .bfx-leaf, .bfx-cover { position: absolute; inset: 0; }

/* Khối trang giấy (màu nền cuối cùng trùng với màn "cánh cửa" ở trang chi tiết) */
.bfx-pages {
  background: #0a0d1c;
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    0 0 0 1px rgba(63,169,255,.55),
    3px 0 0 #161c3c, 6px 0 0 #10152e, 9px 0 0 #0c1026,
    0 0 36px rgba(63,169,255,.35),
    0 24px 50px rgba(0,0,0,.6);
}
.bfx-ink {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(100deg, #1d2550 0, #121733 22%, #0a0d1c 100%);
}
.bfx-ink::before { /* tiêu đề giả */
  content: ""; position: absolute; left: 14%; top: 10%; width: 56%; height: 5%;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(0,229,255,.75), rgba(168,85,247,.6));
  box-shadow: 0 0 12px rgba(63,169,255,.5);
}
.bfx-ink::after { /* dòng chữ giả */
  content: ""; position: absolute; left: 14%; right: 12%; top: 22%; bottom: 10%;
  background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(63,169,255,.2) 14px 16px);
}

/* Trang lật */
.bfx-leaf {
  transform-origin: 0 50%;
  background: #121733;
  border-radius: 2px 8px 8px 2px;
  box-shadow: 0 0 0 1px rgba(63,169,255,.35);
}

/* Bìa sách: mặt trước là ảnh bìa, mặt sau là mặt trong của bìa */
.bfx-cover { transform-origin: 0 50%; transform-style: preserve-3d; }
.bfx-front, .bfx-back {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 2px 8px 8px 2px;
}
.bfx-front {
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--neon-blue);
  background: #12162a center / cover no-repeat;
  box-shadow: 0 0 0 1px rgba(63,169,255,.6), 0 0 30px rgba(63,169,255,.45), 0 18px 40px rgba(0,0,0,.65);
}
.bfx-front::after { /* bóng gáy sách */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 7%;
  background: linear-gradient(90deg, rgba(0,0,0,.45), transparent);
}
.bfx-back {
  transform: rotateY(180deg);
  background: linear-gradient(260deg, #1d2550, #121733);
  box-shadow: 0 0 0 1px rgba(63,169,255,.35);
}

/* ----- Trang chi tiết vừa mở: hai "cánh cửa" tách ra như mở sách ----- */
html.book-arriving::before,
html.book-arriving::after {
  content: ""; position: fixed; top: 0; bottom: 0; width: 50.4vw;
  z-index: 20000; pointer-events: none;
  background: #0a0d1c;
  animation-duration: .95s; animation-delay: .1s;
  animation-timing-function: cubic-bezier(.65,.02,.25,1);
  animation-fill-mode: both;
}
html.book-arriving::before {
  left: 0; transform-origin: 0 50%;
  background: linear-gradient(90deg, #0a0d1c 75%, #151c3d);
  animation-name: bfxDoorL;
}
html.book-arriving::after {
  right: 0; transform-origin: 100% 50%;
  background: linear-gradient(270deg, #0a0d1c 75%, #151c3d);
  animation-name: bfxDoorR;
}
@keyframes bfxDoorL {
  from { transform: perspective(1600px) rotateY(0deg); opacity: 1; }
  85%  { opacity: 1; }
  to   { transform: perspective(1600px) rotateY(-110deg); opacity: 0; }
}
@keyframes bfxDoorR {
  from { transform: perspective(1600px) rotateY(0deg); opacity: 1; }
  85%  { opacity: 1; }
  to   { transform: perspective(1600px) rotateY(110deg); opacity: 0; }
}
html.book-arriving main { animation: bfxMainIn .9s .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes bfxMainIn {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
/* Ảnh bìa ở trang chi tiết xoay vào như bìa sách vừa được mở */
html.book-arriving .book-cover-frame {
  transform-origin: left center;
  animation: bfxCoverIn 1s .55s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes bfxCoverIn {
  from { opacity: 0; transform: perspective(900px) rotateY(-75deg) translateX(-24px); }
  to   { opacity: 1; transform: none; }
}

/* ----- Mọi trang: nội dung hiện nhẹ nhàng khi tải ----- */
main { animation: fxPageIn .45s ease backwards; }
@keyframes fxPageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ----- Thẻ hiện dần khi cuộn tới ----- */
.fx-reveal:not(.fx-in) { opacity: 0; }
.fx-in {
  animation: fxRise .6s cubic-bezier(.2,.7,.2,1) backwards;
  animation-delay: calc(var(--fx-i, 0) * 70ms);
}
@keyframes fxRise { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }

/* ----- Nghiêng 3D + phát sáng khi rê chuột lên thẻ sách ----- */
.book-tile.fx-tilt:hover {
  transform: perspective(800px) translateY(-6px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  box-shadow: 0 18px 40px rgba(63,169,255,.28), 0 0 0 1px rgba(63,169,255,.4);
}
.book-tile .book-tile-cover { transition: filter .25s ease; }
.book-tile:hover .book-tile-cover { filter: brightness(1.1) saturate(1.12); }

/* Người dùng bật "giảm chuyển động": tắt các hiệu ứng trên */
@media (prefers-reduced-motion: reduce) {
  html.book-arriving::before, html.book-arriving::after { display: none; }
  html.book-arriving main, html.book-arriving .book-cover-frame, main, .fx-in { animation: none !important; }
  .fx-reveal:not(.fx-in) { opacity: 1; }
  .book-tile.fx-tilt:hover { transform: translateY(-4px); }
}

/* ---------- Đổi ảnh đại diện ở trang cá nhân ---------- */
.avatar-edit { position: relative; width: 120px; height: 120px; }
.avatar-edit-host { display: block; cursor: pointer; border-radius: 50%; }
.avatar-edit-host .profile-avatar { transition: filter .2s ease, transform .2s ease; }
.avatar-edit-host:hover .profile-avatar { filter: brightness(.8); transform: scale(1.03); }
.avatar-edit-btn {
  position: absolute; right: 0; bottom: 2px;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
  color: #fff; cursor: pointer;
  border: 2px solid var(--bg-void);
  box-shadow: 0 0 14px rgba(63, 169, 255, .5);
  transition: transform .2s ease;
}
.avatar-edit-btn:hover { transform: scale(1.12); }
