/* ===========================
   BookHaven Store – style.css
   =========================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --navy-900: #080e24;
  --navy-800: #0d2040;
  --navy-700: #14325c;
  --navy-600: #1e4a7a;
  --cream-50: #fefdf9;
  --cream-100: #fdf9ef;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Page Transitions ---- */
.page-section {
  animation: fadeInUp 0.45s ease both;
}

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

/* ---- Hero ---- */
.hero-bg-grid {
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}

.book-float {
  animation: bookFloat 4s ease-in-out infinite;
}
.book-1 { animation-delay: 0s; }
.book-2 { animation-delay: 0.8s; }
.book-3 { animation-delay: 1.6s; }

@keyframes bookFloat {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50%       { transform: translateY(-12px) rotate(var(--rot, 0deg)); }
}
.book-1 { --rot: -8deg; }
.book-3 { --rot:  8deg; }

/* ---- Book Card ---- */
.book-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e9e4d9;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(8,14,36,0.15);
}
.book-card .book-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: #f0f4f8;
}
.book-card .book-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.book-card:hover .book-img-wrap img {
  transform: scale(1.06);
}
.book-card .book-actions {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 6px;
  padding: 10px;
  background: linear-gradient(to top, rgba(8,14,36,0.85), transparent);
  transform: translateY(100%);
  transition: transform var(--transition);
}
.book-card:hover .book-actions {
  transform: translateY(0);
}
.book-actions button {
  flex: 1;
  padding: 7px 4px;
  border: none;
  border-radius: 7px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-cart   { background: var(--gold-500); color: var(--navy-900); }
.btn-wish   { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.3) !important; }
.btn-cart:hover { background: var(--gold-400); }
.btn-wish:hover { background: rgba(255,255,255,0.35); }

.badge-new, .badge-sale {
  position: absolute;
  top: 8px; left: 8px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-new  { background: var(--gold-500); color: var(--navy-900); }
.badge-sale { background: #8b1a2e; color: white; }

.stars { color: var(--gold-500); font-size: 12px; letter-spacing: 1px; }

/* ---- Category Card ---- */
.cat-card {
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(0,0,0,0.3); }
.cat-card img { width:100%; height:180px; object-fit:cover; }
.cat-card .cat-overlay {
  position:absolute; inset:0;
  background: linear-gradient(to top, rgba(8,14,36,0.85) 0%, rgba(8,14,36,0.2) 60%, transparent);
  display:flex; align-items:flex-end;
  padding:16px;
}
.cat-full-card {
  border-radius: 16px; overflow:hidden; position:relative; cursor:pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.cat-full-card:hover { transform: scale(1.02); box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.cat-full-card img { width:100%; height:260px; object-fit:cover; }
.cat-full-card .cat-overlay {
  position:absolute; inset:0;
  background: linear-gradient(135deg, rgba(8,14,36,0.75) 0%, rgba(8,14,36,0.2) 100%);
  display:flex; align-items:center; justify-content:center;
  flex-direction:column; gap:8px;
  padding:24px;
}

/* ---- Bestseller Row Card ---- */
.bs-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e9e4d9;
  display: flex;
  gap: 16px;
  padding: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.bs-card:hover { box-shadow: 0 12px 30px rgba(8,14,36,0.1); transform: translateY(-3px); }
.bs-card img { width: 80px; height: 110px; object-fit:cover; border-radius: 8px; flex-shrink:0; }
.bs-rank { font-family:'Playfair Display',serif; font-size:36px; font-weight:900; color:#e9e4d9; line-height:1; min-width:32px; }

/* ---- Author Card ---- */
.author-card {
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition);
}
.author-card:hover { transform: translateY(-6px); }
.author-card img { width:90px; height:90px; border-radius:50%; object-fit:cover; border:3px solid rgba(226,192,96,0.3); margin:0 auto 10px; display:block; transition: border-color var(--transition); }
.author-card:hover img { border-color: var(--gold-500); }

/* ---- Review Card ---- */
.review-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid #e9e4d9;
  transition: box-shadow var(--transition);
}
.review-card:hover { box-shadow: 0 8px 24px rgba(8,14,36,0.08); }
.reviewer-avatar { width:44px; height:44px; border-radius:50%; object-fit:cover; }

/* ---- Blog Card ---- */
.blog-card {
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
}
.blog-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.blog-card img { width:100%; height:200px; object-fit:cover; transition: transform 0.5s ease; }
.blog-card:hover img { transform: scale(1.05); }

/* ---- Cart Item ---- */
.cart-item {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e9e4d9;
  display: flex;
  gap: 16px;
  align-items: center;
}
.cart-item img { width:60px; height:84px; object-fit:cover; border-radius:6px; flex-shrink:0; }
.qty-btn { width:28px; height:28px; border:1px solid #d1d5db; border-radius:6px; background:white; cursor:pointer; font-size:14px; display:flex; align-items:center; justify-content:center; transition: background var(--transition); }
.qty-btn:hover { background:#f3f4f6; }

/* ---- Header scroll effect ---- */
#main-header.scrolled {
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ---- Btn Primary ---- */
.btn-primary {
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity:0; transition: opacity var(--transition);
}
.btn-primary:hover::after { opacity:1; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f4f8; }
::-webkit-scrollbar-thumb { background: #4a83b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2e6399; }

/* ---- Toast ---- */
#toast.show { display: block !important; animation: toastIn 0.3s ease both; }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .bs-card img { width:64px; height:90px; }
  .cart-item img { width:48px; height:68px; }
}
