/* ============================================
   COMPRAORA.NET - Catalogo Sfogliabile
   Font Roboto, stile pulito, catalogo grande
   ============================================ */

* { font-family: 'Roboto', sans-serif; }

/* Area catalogo */
.flyer-main {
  background: #f0eeeb;
  min-height: calc(100vh - 160px);
  padding: 10px 0 20px;
}

/* Viewer */
.book-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 6px;
}

/* Container più grande, meno spazio bordi */
.book-container {
  flex: 1;
  max-width: 1300px;
  aspect-ratio: 1.18 / 1;
  min-height: 680px;
  background: transparent;
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}

.pages-track {
  display: flex;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform;
}

/* === SPREAD (due pagine affiancate) === */
.spread {
  min-width: 100%;
  height: 100%;
  display: flex;
  position: relative;
}

.page {
  min-width: 100%;
  height: 100%;
  background: #fdfbf7;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.page-left,
.page-right {
  width: 50%;
  height: 100%;
  background: #fdfbf7;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.page-left {
  box-shadow: inset -15px 0 20px -15px rgba(0,0,0,0.07);
}

.page-right {
  box-shadow: inset 15px 0 20px -15px rgba(0,0,0,0.05);
}

/* Piega centrale */
.page-crease {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(
    to right,
    rgba(0,0,0,0.08) 0%,
    rgba(0,0,0,0.18) 45%,
    rgba(0,0,0,0.28) 50%,
    rgba(0,0,0,0.18) 55%,
    rgba(0,0,0,0.08) 100%
  );
  pointer-events: none;
  z-index: 30;
}

/* Contenuto pagina */
.page-inner {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header pagina: solo categoria */
.page-header {
  text-align: center;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 2px solid #cc0000;
}

.page-header h2 {
  font-size: 0.95rem;
  font-weight: 900;
  color: #b30000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === GRIGLIA 3 colonne x 4 righe = 12 prodotti === */
.flyer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  align-content: start;
  flex: 1;
}

/* === CARD PRODOTTO === */
.flyer-item {
  background: #fff;
  border: 1px solid #ddd8d2;
  border-radius: 3px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.flyer-item:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  border-color: #ccc;
}

/* NOME PRODOTTO in alto, blu, grassetto, maiuscolo */
.flyer-item-name {
  font-size: 0.66rem;
  font-weight: 900;
  color: #0056b3;
  text-transform: uppercase;
  line-height: 1.15;
  margin-bottom: 2px;
  text-align: center;
  letter-spacing: 0.3px;
}

/* Immagine con sfondo trasparente — compatte */
.flyer-item-img {
  width: 72%;
  margin: 0 auto 2px;
  aspect-ratio: 1 / 1;
  background: transparent;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.flyer-img-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.flyer-img-layer.active {
  opacity: 1;
}

/* Riga: marca a sinistra + prezzo a destra — sempre in fondo */
.flyer-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  margin-bottom: 2px;
  gap: 4px;
}

.flyer-item-brand {
  font-size: 0.72rem;
  font-weight: 900;
  color: #333;
  text-transform: uppercase;
  white-space: nowrap;
}

.flyer-item-price .price-main {
  font-size: 1.5rem;
  font-weight: 900;
  color: #cc0000;
  line-height: 1;
  letter-spacing: -1px;
}

/* Descrizione breve sotto — leggermente più grande */
.flyer-item-desc {
  font-size: 0.66rem;
  color: #555;
  line-height: 1.3;
  font-weight: 500;
}

/* === COPERTINA === */
.page-cover {
  background: linear-gradient(135deg, #cc0000 0%, #990000 100%);
  color: #fff;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.page-cover .cover-content {
  padding: 30px;
}

.page-cover .cover-logo {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 14px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
  letter-spacing: 1px;
}

.page-cover .cover-title {
  font-size: 1.7rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 10px;
  line-height: 1.2;
}

.page-cover .cover-subtitle {
  font-size: 0.95rem;
  opacity: 0.95;
  margin-bottom: 24px;
}

.page-cover .cover-dates {
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  padding: 8px 20px;
  border-radius: 30px;
  display: inline-block;
}

.page-cover .cover-image {
  max-width: 260px;
  margin: 20px auto 0;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* === MINI CARD per copertina === */
.cover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 8px;
}

.mini-item {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.mini-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mini-item-img {
  width: 80%;
  aspect-ratio: 1 / 1;
  margin: 0 auto 2px;
  overflow: hidden;
  border-radius: 3px;
}

.mini-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mini-item-name {
  font-size: 0.55rem;
  font-weight: 700;
  color: #0056b3;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mini-item-specs {
  font-size: 0.55rem;
  color: #555;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 2px;
}

.mini-item-price {
  font-size: 0.85rem;
  font-weight: 900;
  color: #cc0000;
  line-height: 1;
}

/* === RETRO === */
.page-back {
  background: #f5f3ef;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.page-back .back-content {
  padding: 30px;
}

.page-back .back-logo {
  font-size: 1.6rem;
  font-weight: 900;
  color: #cc0000;
  margin-bottom: 16px;
}

.page-back .back-text {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.6;
  max-width: 500px;
}

.page-back .back-cta {
  margin-top: 20px;
  display: inline-block;
  background: #febd69;
  color: #131921;
  padding: 10px 28px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.2s;
}

.page-back .back-cta:hover {
  transform: scale(1.05);
}

/* === FRECCE === */
.nav-arrow {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #333;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 50;
  flex-shrink: 0;
}

.nav-arrow:hover:not(:disabled) {
  background: #febd69;
  transform: scale(1.1);
}

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

/* === INDICATORI === */
.page-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.page-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #bbb;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.page-dot.active {
  background: #cc0000;
  width: 28px;
  border-radius: 5px;
}

/* Footer catalogo */
.flyer-footer-bar {
  text-align: center;
  margin-top: 10px;
}

.flyer-footer-bar span {
  font-size: 0.82rem;
  color: #666;
  font-weight: 600;
}

.page-number {
  position: absolute;
  bottom: 8px;
  right: 14px;
  font-size: 0.68rem;
  color: #bbb;
  font-weight: 600;
}

/* ============================================
   MODAL PRODOTTO
   ============================================ */
.product-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.product-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  max-width: 880px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 2;
}

.product-modal.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #d5d9d9;
  background: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f0f0f0;
  transform: rotate(90deg);
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 28px;
  padding: 28px;
}

.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-main-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f7f8f8;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-main-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-thumbs {
  display: flex;
  gap: 8px;
}

.modal-thumb {
  width: 52px;
  height: 52px;
  border: 2px solid #d5d9d9;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #f7f8f8;
  transition: border-color 0.2s;
}

.modal-thumb:hover,
.modal-thumb.active {
  border-color: #febd69;
}

.modal-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info {
  display: flex;
  flex-direction: column;
}

.modal-brand {
  font-size: 0.78rem;
  color: #007185;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #0f1111;
  margin-bottom: 8px;
  line-height: 1.3;
}

.modal-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.modal-stars {
  color: #ffa41c;
  font-size: 1.1rem;
  letter-spacing: -2px;
}

.modal-reviews {
  color: #007185;
  font-size: 0.85rem;
}

.modal-price {
  font-size: 1.7rem;
  font-weight: 700;
  color: #0f1111;
  margin-bottom: 6px;
}

.modal-stock {
  color: #067d62;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.modal-desc {
  font-size: 0.88rem;
  color: #565959;
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-btn-buy,
.modal-btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: 'Roboto', sans-serif;
}

.modal-btn-buy {
  background: #febd69;
  color: #131921;
}

.modal-btn-buy:hover {
  background: #f3a847;
}

.modal-btn-primary {
  background: transparent;
  border: 1px solid #007185;
  color: #007185;
}

.modal-btn-primary:hover {
  background: #f0f8f9;
}

.modal-shipping {
  font-size: 0.82rem;
  color: #565959;
  padding-top: 10px;
  border-top: 1px solid #d5d9d9;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .book-container {
    max-width: 98%;
    aspect-ratio: auto;
    min-height: 480px;
  }
}

@media (max-width: 900px) {
  .spread {
    flex-direction: column;
  }

  .page-left,
  .page-right {
    width: 100%;
    height: 50%;
  }

  .page-crease {
    display: none;
  }

  .flyer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .page-inner {
    padding: 8px 10px;
  }

  .nav-arrow {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .page-cover .cover-title {
    font-size: 1.4rem;
  }

  .modal-body {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 18px;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-price {
    font-size: 1.4rem;
  }
}

@media (max-width: 500px) {
  .flyer-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .flyer-item-name {
    font-size: 0.8rem;
  }

  .flyer-item-price .price-main {
    font-size: 1.3rem;
  }

  .page-header h2 {
    font-size: 0.85rem;
  }
}
