:root {
  --primary-red: #da251d;
  --secondary-yellow: #ffcd00;
  --dark-bg: #111427;
  --light-bg: #f7f8fb;
  --text-dark: #1f2937;
  --muted: #6b7280;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  background: var(--light-bg);
  color: var(--text-dark);
}

.app-wrapper {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  background: linear-gradient(180deg, #fff, #f7f8fb 40%, #f4f5ff 100%);
}

.navbar-custom {
  background: rgba(218, 37, 29, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.nav-link {
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: color 0.3s ease, opacity 0.3s ease;
}

.nav-link:hover {
  color: var(--secondary-yellow) !important;
  opacity: 0.9;
}

.hero-section {
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 25%),
              radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.18), transparent 26%),
              linear-gradient(135deg, var(--primary-red) 0%, #8b0000 100%);
  position: relative;
  overflow: hidden;
  color: #fff;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}

.star-icon {
  color: var(--secondary-yellow);
  filter: drop-shadow(0 0 10px rgba(255, 205, 0, 0.5));
}

.btn-primary-custom,
.btn-outline-custom,
.btn-ghost {
  border-radius: 999px;
  font-weight: 700;
  padding: 11px 26px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary-red), #ff4444);
  border: none;
  color: #fff;
  box-shadow: 0 12px 25px rgba(218, 37, 29, 0.35);
}

.btn-primary-custom:hover { transform: translateY(-2px) scale(1.02); }

.btn-outline-custom {
  border: 2px solid #fff;
  color: #fff;
}

.btn-outline-custom:hover { background: #fff; color: var(--primary-red); }

.btn-ghost {
  background: #fff;
  color: var(--primary-red);
  border: 2px solid #ffe4e1;
}

.btn-ghost:hover { background: #ffecec; }

.search-box {
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  padding: 14px 22px;
  transition: all 0.25s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.search-box:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 4px rgba(218, 37, 29, 0.12);
}

.category-pill {
  background: #fff;
  border: 2px solid #e5e7eb;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 600;
  color: var(--text-dark);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}

.category-pill:hover,
.category-pill.active {
  background: var(--primary-red);
  border-color: var(--primary-red);
  color: #fff;
  box-shadow: 0 10px 20px rgba(218, 37, 29, 0.2);
}

.book-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: #fff;
  height: 100%;
}

.book-card:hover { transform: translateY(-8px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12); }

.book-cover {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #f5f5f7;
}

.book-3d {
  position: relative;
  width: 180px;
  height: 230px;
  border-radius: 0 10px 10px 0;
  box-shadow: -3px 0 8px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.15), inset -2px 0 5px rgba(0, 0, 0, 0.04);
  transform: perspective(600px) rotateY(-12deg);
  transition: transform 0.35s ease;
  overflow: hidden;
}

.book-card:hover .book-3d { transform: perspective(600px) rotateY(-5deg) translateY(-3px); }

.book-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.2) 10px, rgba(255, 255, 255, 0.2) 20px);
}

.category-badge {
  background: var(--primary-red);
  color: #fff;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s ease;
}

.stat-card:hover { transform: translateY(-5px); }

.stat-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-red), #ff6b6b);
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: #fff;
  font-size: 1.5rem;
}

.footer-section {
  background: linear-gradient(135deg, var(--dark-bg), #0f172a);
  color: #e5e7eb;
}

.footer-section a { color: #cbd5e1; }
.footer-section a:hover { color: #fff; }

.card-body p { margin-bottom: 0; }

/* Detail page */
.detail-hero {
  background: linear-gradient(135deg, #0f172a, #1f2937);
  color: #fff;
  padding: 140px 0 80px;
  position: relative;
  overflow: hidden;
}


.detail-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.detail-cover {
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
}

.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  font-size: 0.92rem;
}

.content-card {
  background: #fffef8;
  border-radius: var(--radius-md);
  border: 1px solid #f3e8ff;
  padding: 20px;
  line-height: 1.75;
  min-height: 260px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.progress-track {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-track .bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-red), var(--secondary-yellow));
  width: 0;
  transition: width 0.25s ease;
}

.pager button {
  min-width: 120px;
}

/* Utilities */
.shadow-soft { box-shadow: var(--shadow-soft); }
.text-muted-2 { color: var(--muted); }

@media (max-width: 991px) {
  .hero-section { padding-top: 120px !important; }
  .book-cover { height: 220px; }
  .book-3d { width: 160px; height: 210px; }
}

@media (max-width: 767px) {
  .navbar-brand svg { display: none; }
  .hero-section h1 { font-size: 2rem; }
  .hero-section .lead { font-size: 1rem; }
  .category-pill { padding: 9px 16px; }
  .book-cover { height: 200px; }
  .detail-hero { padding-top: 110px; }
}

@media (max-width: 575px) {
  .stat-card { padding: 18px; }
  .search-box { padding: 12px 16px; }
  .btn-primary-custom, .btn-outline-custom, .btn-ghost { width: 100%; text-align: center; }
}

@view-transition { navigation: auto; }

/* Mobile typography */
@media (max-width: 768px) {
  body {
    font-size: 14px;
    line-height: 1.65;
  }
  h1 { font-size: 20px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  .meta-chip, .category-badge { font-size: 12px; }
  .navbar-brand .fw-bold { font-size: 1rem !important; }
  .navbar-brand div div:last-child { font-size: 0.65rem !important; }
}
.book-thumb{
  width:100%;
  height: 100%;
  overflow:hidden;
  border-radius:12px;
  text-align: center;
  background: linear-gradient(135deg, #cacaca, #f9f0ef);
}

.book-thumb img{
  height:100%;
}

/* Optional fallback when thumbnail is missing */
.book-thumb-fallback{
  height:100%;
  width:100%;
  display:flex;
  align-items:flex-end;
  padding:16px;
  background: rgba(0,0,0,0.08);
}

.book-thumb-title{
  color:#fff;
  font-weight:800;
  line-height:1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}