/* ==========================================================
   Penerbit Kandel (kandel.co.id) - Style Definition
   Inspired by Pitch Publishing, GPU.id, & Mizan
   ========================================================== */

:root {
  --primary: #1a365d;        /* Deep Academic Navy */
  --primary-light: #2b4c7e;
  --accent: #c05621;         /* Warm Terracotta / Amber */
  --accent-hover: #9c4221;
  --bg-cream: #faf9f6;       /* Warm Bookpaper Tone */
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-light: #e5e7eb;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Serif headings for book publishing aesthetic */
h1, h2, h3, .font-serif-book {
  font-family: 'Merriweather', 'Georgia', serif;
}

/* Book Cover 3D Illusion & Hover Effect */
.book-cover-wrap {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1), box-shadow 0.3s ease;
  transform-origin: center left;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: -4px 6px 16px rgba(0, 0, 0, 0.12), -1px 2px 5px rgba(0, 0, 0, 0.08);
}

.book-cover-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(to right, rgba(0,0,0,0.25) 0%, rgba(255,255,255,0.15) 50%, rgba(0,0,0,0.05) 100%);
  pointer-events: none;
}

.book-card:hover .book-cover-wrap {
  transform: translateY(-6px) scale(1.02);
  box-shadow: -6px 14px 24px rgba(0, 0, 0, 0.18), -2px 4px 8px rgba(0, 0, 0, 0.12);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Sliders */
.slider-container {
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.slider-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Badge styling */
.badge-new {
  background-color: #047857;
  color: white;
}
.badge-bestseller {
  background-color: #b45309;
  color: white;
}

/* Specification Table Grid */
.spec-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem; /* 14px */
  line-height: 1.5;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}
.spec-row:last-child {
  border-bottom: none;
}
.spec-label {
  width: 140px;
  flex-shrink: 0;
  font-weight: 500;
  color: #64748b; /* Slate 500 */
}
.spec-value {
  color: #1e293b; /* Slate 800 */
  font-weight: 500;
  flex-grow: 1;
}

/* Modal animation */
.modal-backdrop {
  backdrop-filter: blur(4px);
  background-color: rgba(15, 23, 42, 0.6);
}

/* Digital sample book viewer */
.sample-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
  background: rgba(8, 15, 32, 0.78);
  backdrop-filter: blur(6px);
}

.sample-viewer-dialog {
  width: min(100%, 1120px);
  max-height: min(94dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #e2e8f0;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 1rem;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
}

.sample-viewer-dialog:fullscreen {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
}

.sample-viewer-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sample-viewer-kicker {
  margin: 0 0 0.15rem;
  color: #fbbf24;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sample-viewer-title {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-family: 'Merriweather', Georgia, serif;
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-viewer-close {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.sample-viewer-close:hover,
.sample-viewer-close:focus-visible {
  color: #fff;
  background: #b45309;
  outline: none;
}

.sample-viewer-body {
  min-height: 280px;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, rgba(71, 85, 105, 0.48), transparent 70%),
    linear-gradient(135deg, #1e293b, #111827 52%, #1e293b);
}

.sample-viewer-stage {
  position: relative;
  width: 100%;
  height: min(67dvh, 650px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  overscroll-behavior: contain;
}

.sample-flipbook {
  width: min(100%, 980px);
  height: 100%;
  margin: auto;
}

.sample-local-pdf {
  width: min(100%, 980px);
  height: 100%;
  margin: auto;
  border: 0;
  border-radius: 0.5rem;
  background: #fff;
}

.sample-zoom-toolbar {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.35rem;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.65rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
}

.sample-zoom-toolbar output {
  min-width: 3.25rem;
  text-align: center;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.sample-zoom-button,
.sample-zoom-fit {
  min-width: 1.9rem;
  min-height: 1.9rem;
  padding: 0 0.4rem;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.sample-zoom-fit { font-size: 0.65rem; }
.sample-zoom-button:hover, .sample-zoom-fit:hover { background: rgba(255, 255, 255, 0.2); }

.sample-viewer-status {
  width: min(100%, 360px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  color: #e2e8f0;
  text-align: center;
  font-size: 0.85rem;
}

.sample-viewer-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: sample-spin 0.8s linear infinite;
}

@keyframes sample-spin {
  to { transform: rotate(360deg); }
}

.sample-viewer-progress-track {
  width: 100%;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

#sample-viewer-progress {
  display: block;
  width: 10%;
  height: 100%;
  background: #f59e0b;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.sample-viewer-error {
  width: min(100%, 430px);
  padding: 1.5rem;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 1rem;
  text-align: center;
}

.sample-viewer-error-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem;
  color: #fecaca;
  background: rgba(220, 38, 38, 0.25);
  border-radius: 50%;
  font-weight: 800;
}

.sample-viewer-error h3 {
  margin: 0 0 0.5rem;
  color: #fff;
  font-family: 'Merriweather', Georgia, serif;
}

.sample-viewer-error p {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.6;
}

.sample-viewer-error .sample-viewer-error-detail {
  margin-top: 0.55rem;
  overflow-wrap: anywhere;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
}

.sample-error-retry {
  margin-top: 1rem;
  padding: 0.6rem 1.1rem;
  color: #fff;
  background: #b45309;
  border: 0;
  border-radius: 0.55rem;
  font-weight: 600;
  cursor: pointer;
}

.sample-viewer-controls {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 1rem 0.25rem;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sample-control-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sample-control-button {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.sample-control-button:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.sample-control-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sample-admin-download {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
}

.sample-page-indicator {
  color: #f8fafc;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sample-viewer-note {
  margin: 0;
  padding: 0 1rem 0.65rem;
  color: #94a3b8;
  background: #0f172a;
  font-size: 0.65rem;
  text-align: center;
}

@media (max-width: 640px) {
  .sample-viewer-overlay { padding: 0; }
  .sample-viewer-dialog { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .sample-viewer-header { min-height: 62px; padding: 0.65rem 0.85rem; }
  .sample-viewer-body { min-height: 240px; padding: 0.4rem 0; }
  .sample-viewer-stage { height: min(70dvh, 640px); }
  .sample-flipbook { width: 100%; }
  .sample-viewer-controls { min-height: 54px; gap: 0.3rem; padding: 0.45rem 0.5rem 0.2rem; }
  .sample-control-button { min-height: 2.15rem; padding: 0.4rem 0.55rem; font-size: 0.68rem; }
  .sample-control-actions { gap: 0.3rem; }
  .sample-page-indicator { font-size: 0.68rem; }
}

/* Line clamp helpers */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Admin Bar */
.admin-bar {
  background: #0f172a;
  color: #e2e8f0;
}
