/* ── Flip card ── */
.flip-card {
  perspective: 1000px;
  position: relative;
  height: 300px;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.10);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.flip-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.1);
}

.flip-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.flip-card:hover .flip-inner {
  transform: rotateY(180deg);
}

.flip-front,
.flip-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: inherit;
}

.flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #1e1b4b 0%, #312e81 100%);
  color: white;
}

@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
  .flip-card:hover .flip-inner { transform: none; }
  .flip-card:hover { transform: none; }
}

/* ── Front face: full-bleed cover ── */
.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 12px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.88));
}

.book-status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(255,255,255,0.18);
  color: white;
  backdrop-filter: blur(4px);
  margin-bottom: 6px;
}

.book-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  color: white;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 11px;
  color: rgba(255,255,255,0.72);
}

/* ── Back face: review ── */
.book-back-inner {
  padding: 14px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.book-back-header {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.book-back-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  color: white;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-stars {
  font-size: 13px;
  line-height: 1;
}

.book-note {
  font-size: 11.5px;
  line-height: 1.55;
  color: rgba(255,255,255,0.82);
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Progress bar on dark back */
.book-back-inner .mt-2 { margin-top: 8px !important; }
.book-back-inner .text-muted { color: rgba(255,255,255,0.5) !important; }
.book-back-inner .progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.15);
  overflow: hidden;
}
.book-back-inner .progress-bar {
  background: linear-gradient(90deg, #a5b4fc, #c4b5fd);
  border-radius: 2px;
}

.book-back-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

.book-pages {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
}

.book-link {
  font-size: 12px;
  font-weight: 700;
  color: #a5b4fc;
  text-decoration: none;
  transition: color 0.15s;
}
.book-link:hover { color: white; }

/* ── Stats cards ── */
#statsContainer { gap: 1rem; }

#statsContainer .card {
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border-radius: 12px !important;
  transition: transform 0.2s, box-shadow 0.2s;
}
#statsContainer .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

#statsContainer .text-primary { color: #6366f1 !important; }
#statsContainer .text-info    { color: #06b6d4 !important; }
#statsContainer .text-success { color: #10b981 !important; }
#statsContainer .text-warning { color: #f59e0b !important; }

/* ── Filter card ── */
.card-body input,
.card-body select {
  font-size: 14px;
  border-radius: 8px;
}

.card-body input:focus,
.card-body select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 0.2rem rgba(99,102,241,0.18);
}

/* Override Bootstrap card for filter card */
.container-fluid > .row > .col-12 > .card {
  border: 1px solid #e2e8f0;
  border-radius: 12px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Section headers ── */
main section h2 {
  font-weight: 700;
  color: #0f172a;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px !important;
}

/* ── Empty states ── */
#emptyReading,
#emptyToRead,
#emptyRead {
  text-align: center;
  padding: 40px 20px;
  font-size: 15px;
  color: #94a3b8;
}

/* ── Modal ── */
.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.modal-header {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 16px 16px 0 0;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.form-label {
  font-weight: 600;
  font-size: 13px;
  color: #374151;
}

/* ── Bootstrap overrides ── */
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #7c3aed) !important;
  border: none !important;
  border-radius: 8px !important;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #6d28d9) !important;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35) !important;
}
.btn-outline-secondary {
  border-radius: 8px !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .flip-card { height: 260px; }
}

@media (max-width: 480px) {
  .flip-card { height: 230px; }
  .book-title { font-size: 12px; }
}

/* ── Entry animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.row { animation: fadeUp 0.35s ease; }
