/* ==========================================================================
   VISIONNEUSE 3D FLIPBOOK & CATALOGUES — MAILLARD-ESTAMPES.COM
   Charte graphique : Noir Galerie (#000000), Rouge Carmin (#f30100), Blanc (#ffffff)
   Typographie : Open Sans & Baskervville
   ========================================================================== */

:root {
  --gallery-black: #000000;
  --gallery-surface: #0e0e0e;
  --gallery-surface-2: #161616;
  --gallery-surface-3: #222222;
  --gallery-border: #262626;
  --gallery-border-light: rgba(255, 255, 255, 0.12);
  --gallery-text-main: #ffffff;
  --gallery-text-muted: #878787;
  --gallery-text-sub: #aaaaaa;

  /* Rouge signature Maillard-Estampes */
  --red-primary: #f30100;
  --red-dark: #b80000;
  --red-gradient: linear-gradient(135deg, #f30100 0%, #b80000 100%);
  --red-glow: 0 4px 16px rgba(243, 1, 0, 0.45);
  --red-glow-subtle: 0 2px 10px rgba(243, 1, 0, 0.25);

  --br: 4px;
  --br-sm: 3px;
  --br-lg: 6px;
}

/* ==========================================================================
   1. VISIONNEUSE PLEIN ÉCRAN (/shop/index.php?route=information/pdf&pdf_id=...)
   ========================================================================== */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body.flipbook {
  background: var(--gallery-black) !important;
  color: var(--gallery-text-main);
  overflow: hidden;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.flipbook-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  background: var(--gallery-black);
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Barre supérieure de la visionneuse */
.flipbook-toolbar {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  background: var(--gallery-surface);
  border-bottom: 1px solid var(--gallery-border);
  gap: 16px;
  flex-shrink: 0;
  z-index: 100000;
}

/* Bouton Retour */
.flipbook-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--gallery-border-light);
  color: #ffffff !important;
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none !important;
  padding: 7px 16px;
  border-radius: var(--br);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.flipbook-back .back-arrow {
  font-size: 14px;
  transition: transform 0.2s ease;
  color: var(--red-primary);
}

@media (hover: hover) and (pointer: fine) {
  .flipbook-back:hover {
    background: var(--red-gradient);
    border-color: var(--red-primary);
    color: #ffffff !important;
    transform: translateX(-2px);
    box-shadow: var(--red-glow);
  }
  .flipbook-back:hover .back-arrow {
    transform: translateX(-3px);
    color: #ffffff;
  }
}

/* Titre du catalogue dans la visionneuse */
.flipbook-title {
  color: var(--gallery-text-main);
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 0;
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bouton Télécharger */
.flipbook-download-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--gallery-border-light);
  color: rgba(255, 255, 255, 0.85) !important;
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none !important;
  padding: 7px 15px;
  border-radius: var(--br);
  transition: all 0.25s ease;
  white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
  .flipbook-download-link:hover {
    background: var(--gallery-surface-3);
    border-color: var(--red-primary);
    color: var(--red-primary) !important;
    box-shadow: var(--red-glow-subtle);
  }
}

/* Conteneur principal du flipbook */
.flipbook-container-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: calc(100vh - 52px);
  background: var(--gallery-black);
}

.flipbook-container-wrapper > div {
  width: 100%;
  height: 100%;
}

.flipbook-embed {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--gallery-black);
}

/* ==========================================================================
   2. STYLES SPÉCIFIQUES MOTEUR 3D DFLIP (ADAPTÉS EN NOIR ET ROUGE)
   ========================================================================== */
.flipbook-fullscreen .df-container {
  height: 100% !important;
  position: relative !important;
  overflow: visible !important;
  background: var(--gallery-black) !important;
}

.flipbook-fullscreen .df-wrapper {
  bottom: 42px !important;
}

/* Barre d'outils inférieure dFlip personnalisée */
.flipbook-fullscreen .df-ui {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-color: var(--gallery-surface) !important;
  border-top: 1px solid var(--gallery-border) !important;
  z-index: 2147483000 !important;
  height: 42px !important;
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  pointer-events: auto !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5) !important;
}

.flipbook-fullscreen .df-ui * {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Boutons dFlip */
.flipbook-fullscreen .df-ui-btn {
  color: #dddddd !important;
  transition: all 0.2s ease !important;
}

.flipbook-fullscreen .df-ui-btn:hover {
  color: var(--red-primary) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
}

.flipbook-fullscreen .df-ui-btn.df-active {
  color: var(--red-primary) !important;
}

/* Champ de saisie / page courante dans la toolbar */
.flipbook-fullscreen .df-ui-page {
  color: #ffffff !important;
  background: var(--gallery-surface-2) !important;
  border: 1px solid var(--gallery-border) !important;
  border-radius: var(--br-sm) !important;
  padding: 2px 6px !important;
}

.flipbook-fullscreen .df-container canvas,
.flipbook-fullscreen .df-container .df-page-loading {
  z-index: 1 !important;
  max-height: calc(100% - 42px) !important;
}

@media (max-width: 768px) {
  .flipbook-toolbar {
    padding: 0 10px;
    height: 46px;
    gap: 10px;
  }
  .flipbook-title {
    font-size: 11px;
    letter-spacing: 0.8px;
  }
  .flipbook-back,
  .flipbook-download-link {
    font-size: 10px;
    padding: 5px 9px;
  }
  .flipbook-container-wrapper {
    height: calc(100vh - 46px);
  }
}

/* ==========================================================================
   3. PAGE CATALOGUES FRONTEND (GRILLE DE LIVRES D'ART 3D)
   Route : /shop/index.php?route=information/pdf
   ========================================================================== */
.flipbook-page-hero {
  padding: 35px 0 25px 0;
  text-align: center;
  background: var(--gallery-black);
  border-bottom: 1px solid var(--gallery-border);
  margin-bottom: 35px;
  position: relative;
}

.flipbook-page-hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 2px;
  background: var(--red-primary);
}

.flipbook-page-hero h1 {
  font-family: 'Open Sans', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--gallery-text-main);
  margin: 0 0 10px 0;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.flipbook-page-hero p.lead {
  font-family: 'Open Sans', sans-serif;
  font-size: 13px;
  color: var(--gallery-text-muted);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Grille des catalogues */
.flipbook-catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 45px 35px;
  padding: 20px 0 70px 0;
}

.flipbook-grid-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ==========================================================================
   4. SIMULATION DE LIVRE D'ART / CATALOGUE RAISONNÉ 3D
   ========================================================================== */
.book-soft-3d {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  max-height: 460px;
  perspective: 1200px;
}

/* Reliure d'art avec ombrage multi-couche de tranches de pages */
.book-catalogue-raisonne .flipbook-cover-link {
  box-shadow:
    /* Tranche de pages d'art ivoire dense */
    2.5px 1px 0px -1px rgba(250, 247, 242, 0.98),
    5px 2.5px 0px -1.5px rgba(238, 233, 222, 0.92),
    8px 4.5px 0px -2.5px rgba(225, 218, 203, 0.88),
    11px 6.5px 0px -3.5px rgba(212, 204, 188, 0.80),
    /* Tranche inférieure */
    0px 4px 0px -2px rgba(234, 229, 218, 0.85),
    /* Ombre portée galerie noire */
    0 3px 8px rgba(0, 0, 0, 0.5),
    10px 18px 36px -6px rgba(0, 0, 0, 0.8),
    20px 32px 64px -10px rgba(0, 0, 0, 0.65);
}

.flipbook-cover-link,
.publication-cover .flipbook-cover-link {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 460px;
  width: auto;
  border-radius: var(--br-sm) var(--br) var(--br) var(--br-sm);
  overflow: hidden;
  background: #faf7f2;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.25, 1),
              box-shadow 0.45s cubic-bezier(0.2, 0.8, 0.25, 1);
  box-sizing: border-box;
  text-decoration: none !important;
}

/* Rainure de mors et reliure à gauche */
.flipbook-cover-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(90deg, 
    rgba(0, 0, 0, 0.35) 0%, 
    rgba(0, 0, 0, 0.10) 10%, 
    rgba(255, 255, 255, 0.25) 16%, 
    rgba(255, 255, 255, 0.00) 20%, 
    rgba(0, 0, 0, 0.20) 24%, 
    rgba(0, 0, 0, 0.05) 32%, 
    transparent 100%
  );
  border-radius: var(--br-sm) 0 0 var(--br-sm);
  pointer-events: none;
  z-index: 2;
}

/* Reflet satiné soyeux sur la couverture */
.flipbook-cover-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(118deg, 
    rgba(255, 255, 255, 0.15) 0%, 
    rgba(255, 255, 255, 0.04) 26%, 
    transparent 50%, 
    rgba(0, 0, 0, 0.05) 100%
  );
  border-radius: var(--br-sm) var(--br) var(--br) var(--br-sm);
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.4s ease;
}

/* Micro-interaction 3D au survol */
@media (hover: hover) and (pointer: fine) {
  .flipbook-cover-link:hover {
    transform: translateY(-6px) rotateY(-3deg) rotateX(1deg);
    box-shadow:
      2.5px 1px 0px -1px rgba(250, 247, 242, 0.98),
      5.5px 2.5px 0px -1.5px rgba(238, 233, 222, 0.92),
      9px 4.5px 0px -2.5px rgba(225, 218, 203, 0.88),
      13px 7px 0px -3.5px rgba(212, 204, 188, 0.80),
      0px 5px 0px -2px rgba(234, 229, 218, 0.85),
      0 5px 14px rgba(0, 0, 0, 0.6),
      14px 24px 48px -6px rgba(0, 0, 0, 0.85),
      26px 42px 78px -10px rgba(0, 0, 0, 0.7);
  }
}

.flipbook-cover-img {
  display: block;
  width: auto;
  height: 380px;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--br-sm) var(--br) var(--br) var(--br-sm);
  transition: transform 0.6s cubic-bezier(0.22, 0.8, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
  .flipbook-cover-link:hover .flipbook-cover-img {
    transform: scale(1.02);
  }
}

/* Overlay sombre au survol avec accents rouge Maillard-Estampes */
.flipbook-cover-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
  border-radius: var(--br-sm) var(--br) var(--br) var(--br-sm);
  text-decoration: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .flipbook-cover-link:hover .flipbook-cover-overlay {
    opacity: 1;
  }
}

.flipbook-cover-icon {
  font-size: 38px;
  margin-bottom: 10px;
  color: var(--red-primary);
  filter: drop-shadow(0 2px 8px rgba(243, 1, 0, 0.5));
}

.flipbook-cover-text {
  color: #ffffff;
  font-family: 'Open Sans', sans-serif;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-weight: 800;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* Métadonnées de la carte de catalogue */
.flipbook-card-meta {
  margin-top: 18px;
  width: 100%;
}

.flipbook-card-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: 0.5px;
  line-height: 1.35;
}

.flipbook-card-title a {
  color: var(--gallery-text-main);
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.flipbook-card-title a:hover {
  color: var(--red-primary) !important;
}

.flipbook-card-sub {
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--gallery-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.flipbook-card-sub i {
  color: var(--red-primary);
}

/* Boutons d'action */
.flipbook-card-actions {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.flipbook-btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gallery-surface-2);
  border: 1px solid var(--gallery-border);
  color: #ffffff !important;
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 18px;
  border-radius: var(--br);
  text-decoration: none !important;
  transition: all 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .flipbook-btn-browse:hover {
    background: var(--red-gradient);
    border-color: var(--red-primary);
    color: #ffffff !important;
    box-shadow: var(--red-glow);
    transform: translateY(-1px);
  }
}

.flipbook-btn-download-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gallery-surface-2);
  border: 1px solid var(--gallery-border);
  color: var(--gallery-text-sub) !important;
  font-size: 13px;
  padding: 8px 13px;
  border-radius: var(--br);
  text-decoration: none !important;
  transition: all 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .flipbook-btn-download-sm:hover {
    color: var(--red-primary) !important;
    border-color: var(--red-primary);
    background: var(--gallery-surface-3);
    box-shadow: var(--red-glow-subtle);
  }
}
