.portfolio-main {
  padding-top: 3.5rem !important;
}

.portfolio-main .modelNameBook {
  font-family: 'Louis George Cafe Bold', sans-serif;
  text-align: center;
  font-size: 1.875rem;
  margin-bottom: 0.25rem;
  margin-top: -20px;
  letter-spacing: .02em;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: bold;
}

.back-button-container {
  text-align: center;
  padding: 1.5rem 0 0.5rem 0;
  position: relative;
  top: 0;
}

.back-button {
  background: none;
  color: #333;
  border: none;
  padding: 0.25rem 0;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.3s ease;
  position: relative;
}

.back-button:hover {
  color: #6b7280;
  transform: translateY(-2px);
}

.back-button::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #000;
  transition: width .3s ease;
}

.back-button:hover::after {
  width: 100%;
}

.carousel-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: -15px auto 0.5rem;
  aspect-ratio: 2/3;
  overflow: visible;
  max-height: 500px;
  padding: 0 15px;
  box-sizing: content-box;
}

.carousel-images {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  z-index: 0;
  
}

.carousel-slide:first-child {
  left: -14px;
}

.carousel-slide.active {
  opacity: 1;
  transform: translateX(0);
  z-index: 2;
}

.carousel-slide.prev {
  transform: translateX(-100%);
}

.carousel-slide.next {
  transform: translateX(100%);
}

.carousel-slide img, .carousel-slide video {
  height: 420px;
  max-width: none;
  max-height: none;
  object-fit: contain;
  display: block;
}

.carousel-slide video {
  background-color: black;
}

.carousel-slide.pair {
  gap: 20px;
  padding: none;
}

.carousel-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  width: 50px;
  height: 150px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-button.prev {
  left: 0px;
}

.carousel-button.next {
  right: 0px;
}

.carousel-button:hover {
  transform: translateY(-50%) scale(1.2);
}

.carousel-button::before {
  content: '';
  width: 50px;
  height: 150px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.carousel-button.prev::before {
  background-image: url('../assets/buttons/prev.svg');
}

.carousel-button.next::before {
  background-image: url('../assets/buttons/next.svg');
}

.model-details-container {
  margin: 0.25rem 0;
  padding: 0.25rem;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background-color: #fefefe;
}

.model-details-container h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--color-text-light);
}

.modelBookMeasurements {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: .5rem;
  justify-content: center;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
  overflow-x: auto;
  padding-bottom: .5rem;
}

/* Loading spinner styles */
.image-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  opacity: 0.8;
  z-index: 1;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.carousel-slide.loading img {
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.carousel-slide.loaded img {
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

.carousel-slide.loading {
  background-color: #f8f9fa;
  position: relative;
}

.carousel-slide.loaded {
  background-color: transparent;
}

@media (max-width: 768px) {
  .image-loading {
    width: 30px;
    height: 30px;
    border-width: 2px;
  }

  .carousel-slide.loading {
    background-color: #f8f9fa;
  }

  .modelBookMeasurements {
    flex-wrap: wrap;
    padding-bottom: 0.5rem;
  }

  .portfolio-main .modelNameBook {
    font-size: 1.5rem;
  }

  .carousel-container {
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    margin-top: 10px;
  }

  .carousel-images {
    display: flex;
    transition: none;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    scroll-snap-stop: always;
  }

  .carousel-images::-webkit-scrollbar {
    display: none;
  }

  .carousel-slide {
    position: static;
    flex: 0 0 85vw;
    opacity: 1;
    transform: none;
    z-index: 1;
    margin-right: 15px;
    scroll-snap-align: center;
  }

  .carousel-slide img {
    max-width: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease-in-out;
  }

  .carousel-slide:not(.horizontal) img {
    height: 70vh;
    object-fit: contain;
  }

  /* Horizontal images keep original aspect ratio */
  .carousel-slide.horizontal img {
    height: auto;
    max-height: 70vh;
  }

  .carousel-button {
    display: none;
  }

  .model-details-container {
    padding: 0.5rem;
  }

  .model-details-container h2 {
    font-size: 1.125rem;
  }

  .portfolio-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
  }

  .portfolio-grid img {
    width: 100%;
    height: 95px;
    object-fit: cover;
  }

  .portfolio-tabs {
    margin: 1.5rem 0; /* Increased margin to prevent overlap */
    z-index: 5; /* Ensure tabs are above carousel */
    position: relative; /* Needed for z-index */
  }
}


.modelBookMeasurements .measurement-item {
  background-color: var(--color-background);
  padding: .5rem 1rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  text-align: center;
  white-space: nowrap;
  transition: transform .2s ease;
}

.modelBookMeasurements .measurement-item:not(.non-convertible) {
  cursor: pointer;
}

.modelBookMeasurements .measurement-item:not(.non-convertible):hover {
  transform: scale(1.05);
}

.modelBookMeasurements .measurementName {
  font-family: 'Louis George Cafe Bold', sans-serif;
  font-size: .8rem;
  color: var(--color-text-light);
  margin-bottom: .15rem;
  font-weight: bold;
}

.modelBookMeasurements .measurements {
  font-family: 'Proxima Nova' , sans-serif;
  font-size: .85rem;
  color: var(--color-text-light);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

.portfolio-grid img {
  width: 100%;
  height: 375px;
  object-fit: cover;
}

/* Portfolio tabs styling */
.portfolio-tabs {
  display: flex;
  justify-content: center; /* Mantener centrado por defecto */
  align-items: center; /* Alinear verticalmente los elementos */
  gap: 1rem;
  margin: 0.5rem 0;
  padding: 0;
}

.portfolio-tab {
  background: none;
  color: #333;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.portfolio-tab:hover {
  color: #6b7280;
  transform: translateY(-2px);
}

.portfolio-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #000;
  transition: width .3s ease;
}

.portfolio-tab:hover::after {
  width: 100%;
}

.portfolio-tab.active {
  color: #000;
  font-weight: 700;
}

.portfolio-tab.active::after {
  width: 100%;
  background-color: #000;
}

/* Prevent hover styles on active tab */
.portfolio-tab.active:hover {
  color: #000;
  transform: none;
}

.portfolio-name-wrapper {
  text-align: center;
  margin-bottom: 2rem;
}

.portfolio-name {
  font-size: 2.25rem;
  font-weight: bold;
  text-transform: capitalize;
  letter-spacing: .05em;
  font-family: 'Louis George Cafe Bold', sans-serif;
}

.portfolio-sub-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: .75rem 0;
}

.portfolio-sub-nav a {
  text-transform: uppercase;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: .05em;
  color: var(--color-text-light);
  transition: color .3s ease;
}

.portfolio-sub-nav a:hover {
  color: var(--color-accent);
}

.portfolio-sub-nav a.active {
  color: var(--color-accent);
  font-weight: 700;
}

.portfolio-content-section {
  display: none;
}

.portfolio-content-section.active {
  display: block;
}

.portfolio-tabs .back-button {
  background: none;
  color: #333;
  border: none;
  padding: 0; /* Eliminar padding extra */
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  font-family: 'Proxima Nova', sans-serif; /* Asegurar la fuente */
  font-weight: normal; /* Asegurar el peso de la fuente */
}

.portfolio-tabs .back-button:hover {
  color: #6b7280;
  transform: translateY(-2px);
}

.portfolio-tabs .back-button::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #000;
  transition: width .3s ease;
}

.portfolio-tabs .back-button:hover::after {
  width: 100%;
}
