/* ============================================
   UNFARI Press Catalog - Main Application Styles
   Extends DaisyUI / Tailwind CSS
   ============================================ */

/* ──────────────────────────────────────────────
   Font Setup
   ────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ──────────────────────────────────────────────
   DaisyUI Theme Override — UNFARI Maroon
   ────────────────────────────────────────────── */

[data-theme="light"] {
  --color-primary: #800020;
  --color-primary-content: #ffffff;
  --color-secondary: #b8860b;
  --color-secondary-content: #ffffff;
  --color-accent: #5c0014;
}

[data-theme="dark"] {
  --color-primary: #a83246;
  --color-primary-content: #ffffff;
  --color-secondary: #d4a017;
  --color-secondary-content: #1a1a1a;
  --color-accent: #c44563;
}

:root {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --cover-ratio: 2 / 3;
  --transition-speed: 0.3s;
  --unfari-maroon: #800020;
  --unfari-maroon-dark: #5c0014;
  --unfari-gold: #b8860b;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ──────────────────────────────────────────────
   Book Card Hover Effects
   ────────────────────────────────────────────── */

.book-card {
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
  will-change: transform;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

.book-card:active {
  transform: translateY(-2px);
}

/* ──────────────────────────────────────────────
   Cover Image Aspect Ratio (2:3)
   ────────────────────────────────────────────── */

.cover-container {
  aspect-ratio: var(--cover-ratio);
  overflow: hidden;
  position: relative;
  background-color: oklch(var(--b2));
}

.cover-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--transition-speed) ease,
              transform var(--transition-speed) ease;
}

/* Lazy load fade-in */
.cover-container img:not(.loaded) {
  opacity: 0;
}

.cover-container img.loaded {
  opacity: 1;
}

.cover-container:hover img {
  transform: scale(1.03);
}

/* ──────────────────────────────────────────────
   Smooth Transitions (general)
   ────────────────────────────────────────────── */

a,
button,
.btn {
  transition: all var(--transition-speed) ease;
}

/* Search dropdown */
#search-dropdown {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#search-dropdown.hidden {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

/* Tab content transition */
[data-tab-panel] {
  animation: fadeIn 0.25s ease-in-out;
}

/* ──────────────────────────────────────────────
   PDF Reader Styles
   ────────────────────────────────────────────── */

/* Reader container */
#pdf-reader {
  position: relative;
  background-color: oklch(var(--b3));
  min-height: 100vh;
}

#pdf-reader:fullscreen {
  background-color: oklch(var(--b1));
}

/* Toolbar */
.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: oklch(var(--b1));
  border-bottom: 1px solid oklch(var(--bc) / 0.1);
  flex-wrap: wrap;
}

.reader-toolbar .btn {
  min-height: 2rem;
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
}

.reader-toolbar input[type="number"] {
  width: 4rem;
  text-align: center;
}

/* Canvas container */
#canvas-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
}

#pdf-canvas {
  max-width: 100%;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
  background-color: white;
}

/* Progress bar */
.reader-progress-track {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: oklch(var(--bc) / 0.1);
  z-index: 40;
}

#reader-progress {
  height: 100%;
  background-color: oklch(var(--p));
  transition: width 0.3s ease;
  border-radius: 0 2px 2px 0;
}

/* Loading spinner */
#reader-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: oklch(var(--b1) / 0.8);
  z-index: 50;
}

/* Error message */
#reader-error {
  text-align: center;
  padding: 3rem 1rem;
  color: oklch(var(--er));
  font-size: 1.125rem;
}

/* ──────────────────────────────────────────────
   Scrollbar Styling
   ────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: oklch(var(--bc) / 0.2);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: oklch(var(--bc) / 0.35);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: oklch(var(--bc) / 0.2) transparent;
}

/* ──────────────────────────────────────────────
   Animation Keyframes
   ────────────────────────────────────────────── */

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

.animate-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

.animate-slide-up {
  animation: slideUp 0.4s ease-out;
}

/* Staggered entrance for book cards */
.book-card:nth-child(1)  { animation-delay: 0s; }
.book-card:nth-child(2)  { animation-delay: 0.05s; }
.book-card:nth-child(3)  { animation-delay: 0.1s; }
.book-card:nth-child(4)  { animation-delay: 0.15s; }
.book-card:nth-child(5)  { animation-delay: 0.2s; }
.book-card:nth-child(6)  { animation-delay: 0.25s; }
.book-card:nth-child(7)  { animation-delay: 0.3s; }
.book-card:nth-child(8)  { animation-delay: 0.35s; }

/* ──────────────────────────────────────────────
   Print Styles
   ────────────────────────────────────────────── */

@media print {
  /* Hide navigation and footer */
  nav,
  .navbar,
  footer,
  .drawer-side,
  .reader-toolbar,
  .reader-progress-track,
  #toast-container,
  .btn {
    display: none !important;
  }

  /* Ensure clean printing */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
  }

  .book-card {
    box-shadow: none !important;
    transform: none !important;
    break-inside: avoid;
  }

  a {
    text-decoration: underline;
    color: black !important;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }
}

/* ──────────────────────────────────────────────
   Toast Container
   ────────────────────────────────────────────── */

#toast-container {
  pointer-events: none;
}

#toast-container > * {
  pointer-events: auto;
}
