/* === VARIABLES === */
:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --border: #2a2a2a;
  --border-hover: #e74c3c;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #e74c3c;
  --accent-dark: #c0392b;
  --nav-bg: rgba(15, 15, 15, 0.95);
  --radius: 10px;
  --radius-sm: 6px;
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* === BASE === */
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ================================
   BIBLIOTHÈQUE
   ================================ */

.library-header {
  text-align: center;
  padding: 32px 16px 24px;
}

.library-header h1 {
  font-size: 1.8rem;
  color: var(--accent);
  letter-spacing: 0.03em;
}

/* Grille — mobile first : 1 colonne */
.library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 0 16px 40px;
  max-width: 1000px;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .library-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .library-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Carte webtoon */
.webtoon-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.webtoon-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

/* Bannière couverture */
.card-cover {
  width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: top;
  display: block;
}

/* Placeholder si pas de cover.webp */
.card-cover-placeholder {
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

/* Corps de la carte */
.card-body {
  padding: 14px 16px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-progress {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

/* ================================
   LECTEUR
   ================================ */

/* Barre de navigation fixe */
#nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  padding: 10px 12px;
}

#nav-bar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 800px;
  margin: 0 auto;
}

/* Boutons nav */
.nav-btn {
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: #333;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
  white-space: nowrap;
}

.nav-btn:hover:not(:disabled) {
  background: #555;
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-btn--home {
  background: #444;
}

.nav-btn--home:hover {
  background: #666;
}

.nav-btn--next {
  background: var(--accent);
}

.nav-btn--next:hover:not(:disabled) {
  background: var(--accent-dark);
}

/* Titre centré dans la nav */
#nav-title {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Zone d'affichage des images */
#viewer {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  margin-top: 60px;
  display: flex;
  flex-direction: column;
}

/* Images — colonne unique, zéro espace */
#viewer figure {
  margin: 0;
  padding: 0;
  line-height: 0;
}

#viewer img {
  width: 100%;
  display: block;
}

/* Message de chargement */
.viewer-info {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

/* Bouton retour en haut */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  display: none;
  z-index: 1000;
  transition: background 0.2s;
}

#back-to-top:hover {
  background: var(--accent-dark);
}
