/**
 * HB Édition - Light Luxury Design System & 3D Book Styles
 */

:root {
  --hb-primary: #1e3a8a;
  --hb-primary-hover: #172554;
  --hb-accent-gold: #d97706;
  --hb-accent-gold-light: #fef3c7;
  --hb-bg-light: #ffffff;
  --hb-bg-subtle: #f8fafc;
  --hb-text-main: #0f172a;
  --hb-text-muted: #64748b;
  --hb-border: #e2e8f0;
  --hb-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --hb-shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --hb-shadow-lg: 0 20px 35px -5px rgba(0, 0, 0, 0.09), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* 3D Book Container & Realistic Perspective */
.book-3d-wrapper {
  perspective: 1200px;
  transform-style: preserve-3d;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 10px;
}

.book-3d {
  position: relative;
  width: 220px;
  height: 310px;
  transform-style: preserve-3d;
  transform: rotateY(-18deg) rotateX(6deg);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.5s ease;
  cursor: pointer;
}

.book-3d:hover {
  transform: rotateY(-6deg) rotateX(2deg) translateY(-8px) scale(1.03);
}

.book-3d.is-flipped {
  transform: rotateY(-175deg) rotateX(4deg) translateY(-8px);
}

.book-cover {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  box-shadow: 
    -4px 0 6px rgba(0, 0, 0, 0.15),
    12px 14px 28px rgba(15, 23, 42, 0.18),
    2px 2px 4px rgba(0, 0, 0, 0.08);
  backface-visibility: hidden;
  background-color: #f1f5f9;
}

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

/* Book Spine Simulation */
.book-cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 26px;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0) 0%, 
    rgba(0, 0, 0, 0.18) 18%, 
    rgba(255, 255, 255, 0.35) 28%, 
    rgba(0, 0, 0, 0.08) 50%, 
    rgba(255, 255, 255, 0) 100%);
  z-index: 5;
  pointer-events: none;
}

/* Glossy highlight on book cover */
.book-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
  z-index: 4;
}

/* Book Back Cover */
.book-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px 4px 4px 10px;
  overflow: hidden;
  box-shadow: 
    4px 0 6px rgba(0, 0, 0, 0.15),
    -12px 14px 28px rgba(15, 23, 42, 0.18);
  backface-visibility: hidden;
  transform: rotateY(180deg);
  background-color: #0f172a;
}

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

/* Realistic Book Pages / Depth on right side */
.book-pages-edge {
  position: absolute;
  top: 4px;
  right: -12px;
  width: 14px;
  height: calc(100% - 8px);
  background: repeating-linear-gradient(
    90deg,
    #f8fafc 0px,
    #e2e8f0 1px,
    #f1f5f9 2px,
    #cbd5e1 3px
  );
  transform: rotateY(90deg) translateZ(-7px);
  border-radius: 0 2px 2px 0;
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.12);
  z-index: 1;
}

/* Slide-over Cart Drawer */
.cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 999;
}

.cart-drawer-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.cart-drawer.is-active {
  transform: translateX(0);
}

/* Shipping Progress Bar */
.shipping-progress-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.shipping-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Category Filter Pills */
.filter-pill {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.25s ease;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
}

.filter-pill:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.filter-pill.is-active {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

/* Badge Glow */
.badge-gold {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border: 1px solid #fcd34d;
}

.badge-blue {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-green {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

/* Format Select Radio Pills */
.format-option {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
}

.format-option:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.format-option.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Floating Cart Trigger Badge */
.cart-floating-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e3a8a;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(30, 58, 138, 0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  z-index: 900;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cart-floating-trigger:hover {
  transform: translateY(-4px) scale(1.03);
  background: #172554;
  box-shadow: 0 14px 30px rgba(30, 58, 138, 0.45);
}

/* Modal Reader Preview */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.modal-content-card {
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-overlay.is-active .modal-content-card {
  transform: scale(1);
}
