/* Estructura principal del producto */
.single-product div.product {
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0px;
}
.summary.entry-summary {
  order: 1;
}
.woocommerce div.product div.images.woocommerce-product-gallery {
  order: 3;
}
.woocommerce-page div.product div.summary form {
 display: none;
}
.woocommerce .woocommerce-breadcrumb {
  text-align: center;
}
ol.flex-control-nav.flex-control-thumbs {
  display: none;
}
.woocommerce .woocommerce-breadcrumb {
  margin-top: 20px;
}
/* Contenedor del formulario */
#couple-custom-form {
  width: 100%;
  margin: 0;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Grupos de opciones en el formulario */
#couple-custom-form .option-group,
#couple-custom-form .story-group {
  margin-bottom: 25px;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 6px;
}

/* Etiquetas del formulario */
#couple-custom-form label {
  display: block;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
  font-size: 16px;
}

/* Campos de texto y áreas de texto */
#couple-custom-form input[type="text"],
#couple-custom-form textarea {
  width: 100%;
  padding: 15px;
  margin-top: 8px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.5;
  background-color: #fff;
  transition: all 0.3s ease;
}

#couple-custom-form input[type="text"]:focus,
#couple-custom-form textarea:focus {
  border-color: #4a90e2;
  outline: none;
  box-shadow: 0 0 5px rgba(74, 144, 226, 0.2);
}

/* Campos de archivo */
#couple-custom-form input[type="file"] {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 2px dashed #ddd;
  border-radius: 4px;
  background-color: #f8f9f9;
  cursor: pointer;
  transition: all 0.3s ease;
}

#couple-custom-form input[type="file"]:hover {
  border-color: #4a90e2;
  background-color: #f0f4f8;
}

/* Contenedor principal del producto personalizado */
.product-customizer-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    order: 2;
}

/* Columna izquierda (formulario) */
.customizer-left {
    flex: 0 0 50%;
    width: 50%;
    min-width: 400px;
}

/* Columna derecha (preview) */
.customizer-right {
    flex: 0 0 50%;
    width: 50%;
    position: sticky;
    top: 20px;
   /* height: calc(100vh - 40px);*/
    min-width: 400px;
}

/* Contenedor del preview */
.prev {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Contenedor principal del preview */
#book-preview {
    width: 100%;
    height: 0;
    padding-bottom: 133.33%;
    position: relative;
    background: #fff;
    overflow: hidden;
    background-image: url("./Juntos_Libro.jpeg");
    background-repeat: no-repeat;
    background-position: center;
}

/* Flipbook */
#flipbook {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Páginas */
#flipbook .page,
#flipbook .hard {
    background-color: #fff;
}

/* Portada */
.cover-page {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.cover-background {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
    z-index: 1 !important;
}

.cover-image {
    position: absolute !important;
    top: 12% !important;
    left: 5.5% !important;
    width: 91% !important;
    height: 84% !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    -webkit-mask-size: contain !important;
    -webkit-mask-position: center !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-size: contain !important;
    mask-position: center !important;
    mask-repeat: no-repeat !important;
    z-index: 2 !important;
}

/* Soporte específico para Firefox */
@-moz-document url-prefix() {
    .cover-image {
        mask-image: var(--mask-image) !important;
        mask-size: contain !important;
        mask-position: center !important;
        mask-repeat: no-repeat !important;
    }
}

.cover-decorations {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    z-index: 3 !important;
}

.cover-overlay {
    position: absolute !important;
    bottom: 10% !important;
    left: 0 !important;
    width: 100% !important;
    text-align: center !important;
    z-index: 4 !important;
    padding: 20px !important;
}

.cover-overlay h1 {
    font-size: 24px;
    color: #333;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.7);
    padding: 10px;
    border-radius: 5px;
    display: inline-block;
}

/* Diseño */
.design-layout {
    display: grid;
    gap: 20px;
    padding: 20px;
    height: 100%;
}

.design-layout-1,
.design-layout-3 {
    grid-template-rows: repeat(2, 1fr);
}

.design-layout-2 {
    grid-template-rows: repeat(3, 1fr);
}

.design-photo {
  width: 92.5%;
  height: 88.5%;
  overflow: hidden;
  top: 44px;
  left: 24px;
}


.photo-wrapper {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* Historia */
.story-content {
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.story-content h2 {
    text-align: center;
    margin-bottom: 20px;
}

.story-text {
    flex: 1;
    overflow-y: auto;
    line-height: 1.6;
}

.page-number {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

/* Controles del libro */
#book-controls {
  margin-top: 30px;
  text-align: center;
  padding: 20px;
}

#book-controls button {
  padding: 12px 24px;
  margin: 0 10px;
  font-size: 16px;
  background: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#book-controls button:hover {
  background: #357abd;
}

/* Botones principales */
.buttons-container {
  margin-top: 30px;
  text-align: center;
}

.buttons-container button {
  background-color: #4a90e2;
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
  margin: 10px;
  min-width: 200px;
}

.buttons-container button:hover {
  background-color: #357abd;
}

/* Precio actual */
.price-info {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 4px;
  text-align: center;
  margin: 30px 0;
  font-size: 20px;
  color: #333;
  font-weight: bold;
}

/* Botón de añadir página */
.add-page-btn {
  background-color: #4a90e2;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
}

.add-page-btn:hover {
  background-color: #357abd;
}

/* Mensajes de estado */
.loading-preview {
  text-align: center;
  padding: 30px;
  background: rgba(255,255,255,0.95);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.loading-progress {
  margin-top: 10px;
  font-size: 14px;
  color: #4a90e2;
  font-weight: bold;
}

/* Notificaciones */
.snackbar {
  visibility: hidden;
  min-width: 250px;
  background-color: #333;
  color: #fff;
  padding: 16px;
  text-align: center;
  border-radius: 4px;
  position: fixed;
  z-index: 999;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.5s, visibility 0.5s;
}

.snackbar.show {
  visibility: visible;
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .product-customizer-container {
    flex-direction: column;
    padding: 10px;
  }

  .customizer-left,
  .customizer-right {
    max-width: 100%;
  }

  .customizer-right {
    position: relative;
    height: auto;
    top: 0;
  }

  #book-preview {
    padding-bottom: 133.33%; /* Mantener proporción 3:4 */
  }

  .buttons-container button {
    width: 100%;
    margin: 5px 0;
    min-width: auto;
  }

  #book-controls button {
    width: calc(50% - 10px);
    margin: 5px;
    padding: 10px;
    font-size: 14px;
  }

  .price-info {
    margin: 15px 0;
    padding: 15px;
    font-size: 18px;
  }

  .story-content h2 {
    font-size: 1.2em;
  }

  .story-text {
    font-size: 12px;
    line-height: 1.4;
  }

  /* Ajustes responsivos para la portada */
  .cover-image {
    top: 5%;
    left: 4%;
    width: 92%;
    height: 90%;
  }
  
  .cover-decorations {
    background-size: 98% auto;
  }

  .cover-overlay h1 {
    font-size: 1.4em;
    max-width: 90%;
    padding: 8px 16px;
  }
}

/* Para pantallas muy pequeñas */
@media (max-width: 480px) {
  .cover-image {
    top: 4%;
    left: 3.5%;
    width: 93%;
    height: 92%;
  }
  
  .cover-overlay h1 {
    font-size: 1.2em;
    padding: 6px 12px;
  }
}

/* Asegurar que las imágenes del producto se muestren correctamente */
.woocommerce-product-gallery__image {
  text-align: center;
}

.woocommerce-product-gallery__image img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* Página de diseño */
.design-page {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.design-background {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
    z-index: 1 !important;
}

.design-photos {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 2 !important;
}

.design-photo {
    position: absolute !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    -webkit-mask-size: contain !important;
    -webkit-mask-position: center !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-size: contain !important;
    mask-position: center !important;
    mask-repeat: no-repeat !important;
}

.design-decorations {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    z-index: 3 !important;
}

/* Soporte específico para Firefox */
@-moz-document url-prefix() {
    .design-photo {
        mask-image: var(--mask-image) !important;
        mask-size: contain !important;
        mask-position: center !important;
        mask-repeat: no-repeat !important;
    }
}

/* Ajustes para las páginas del libro */
#flipbook .page {
    background-color: #fff !important;
}

/* Estilos específicos para cada tipo de página */
#flipbook .page.design-page {
    z-index: 2 !important; /* Asegurar que está después de la portada */
}

#flipbook .page .story-content {
    padding: 40px !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
}

#flipbook .page .story-content h2 {
    text-align: center !important;
    margin-bottom: 30px !important;
    color: #333 !important;
}

#flipbook .page .story-content .story-text {
    flex: 1 !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    overflow-y: auto !important;
    padding: 90px 20px 20px !important;
}

#flipbook .page .story-content .page-number {
    text-align: center !important;
    margin-top: 20px !important;
    color: #666 !important;
    font-size: 14px !important;
}