/* === POLICES === */
body {
  margin: 0;
  padding: 0;
  background-color: #1b1c34;
  color: white;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 0.2px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* === BANDEAU TITRE === */
.topbar {
  background-color: rgba(0, 0, 0, 0.55);
  padding: 14px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.topbar .title {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #f2f2f2;
}

/* === BOUTONS & MENU === */
.controls-top {
  display: flex;
  justify-content: center;
  gap: 12px;
  background-color: rgba(30, 30, 50, 0.45);
  padding: 12px;
}

.controls-top button,
.menu-deroulant {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.22);
  color: white;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all .2s ease;
  font-size: 0.95rem;
  font-family: 'Montserrat', sans-serif;
  backdrop-filter: blur(4px);
}

.controls-top button:hover,
.menu-deroulant:hover {
  background: rgba(255,255,255,0.28);
}

/* Menu déroulant amélioré */
.menu-deroulant {
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.menu-deroulant option {
  background-color: #1b1c34;
  color: white;
}

/* === VIEWPORT === */
.viewport {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.page-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.page {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 2px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  box-shadow: 0 0 28px rgba(0,0,0,0.45);
  cursor: zoom-in;
  transition: box-shadow .25s ease;
}

.page:hover {
  box-shadow: 0 0 36px rgba(0,0,0,0.65);
}

/* === FLÈCHES === */
.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 1.9rem;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  border: none;
  color: white;
  cursor: pointer;
  transition: background .25s ease, transform .2s ease;
  backdrop-filter: blur(4px);
}

.arrow:hover {
  background: rgba(255,255,255,0.32);
  transform: translateY(-50%) scale(1.18);
}

.arrow-left { left: 22px; }
.arrow-right { right: 22px; }

/* === ZOOM OVERLAY === */
#zoomOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn .25s ease-out forwards;
}

#zoomOverlay.closing {
  animation: fadeOut .25s ease-in forwards;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Image dans le zoom */
#zoomOverlay img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  cursor: grab;
  transition: transform 0.15s ease-out;
}

#zoomOverlay img:active {
  cursor: grabbing;
}

/* === BOUTON FERMETURE === */
#closeZoom {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.25);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  transition: all .2s ease;
  backdrop-filter: blur(4px);
}

#closeZoom:hover {
  background: rgba(255,255,255,0.38);
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(255,255,255,0.5);
}

/* === MOBILE === */
@media (max-width: 768px) {

  .controls-top {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 6px;
    padding: 10px;
  }

  #backBtn {
    grid-column: 1 / 2;
    order: -1;
    position: static !important;
  }

  .viewport {
    height: calc(100vh - 155px);
  }

  .arrow {
    width: 34px;
    height: 34px;
    font-size: 1.3rem;
  }

  .arrow-left { left: 6px; }
  .arrow-right { right: 6px; }
}
