:root {
  --bg-color: #e8e8e8;
  --bg-color-2: #ffffff;
  --text-color: #111111;
  --accent-color: #878787;
}
.dark-mode {
  --bg-color: #1b1a26;
  --bg-color-2: #313041;
  --text-color: #f5f5f5;
  --accent-color: #970000;
}
/**************/
/***GLOBALES***/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body, #app-container, .studio-sampler {
    height: 100%;
}
body {
  font-family: Arial, sans-serif;
  width: 100%;
  margin: auto;
  color: var(--text-color);
}
.studio-sampler{
  background-color: var(--bg-color);
  padding: 2em;
  border-radius: 2em;
  border: 1px solid var(--text-color);
}
h1, h2{
  text-align: center;
  font-weight: 400;
  margin-top: 0;
  text-transform: uppercase;
}
select, button {
  width: 100%;
  margin: 0.5rem 0 1rem;
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 2em;
  color: var(--text-color);
}
select{
  background-color: var(--bg-color-2);
}
button {
  background-color: var(--bg-color);
  border: 2px solid var(--accent-color);
}
button:hover{
  background-color: var(--accent-color);
}
button:disabled {
  background: var(--bg-color);
  cursor: not-allowed;
}

/* Fullscreen overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.fullscreen-content {
    position: relative;
    height: 100%;
}
.fullscreen-content img {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
}
.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;

}
/******/
.fullscreen-image {
    transition: transform 0.3s ease;
    cursor: zoom-in;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
}

.fullscreen-image.zoomed {
    transform: scale(2);
    cursor: grab;
}

.fullscreen-image.zoomed:active {
    cursor: grabbing;
}
/*********************/
/***STUDIO SELECTOR***/
.preview-container {
  flex: 1; 
  min-height: 200px;
  position: relative;
}
.selector-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.maximize-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  cursor: pointer;
}
#zoom-btn, .maximize-btn {
  padding: 5px 5px;
  height: 32px;
  width: 32px;

}
@media (min-aspect-ratio: 1/1) {
  .selector-container {
    display: grid;
    grid-template-columns: 40% 60%;  /* 2 columnas */
    grid-template-rows: 1fr auto; /* filas: contenido y footer */
    gap: 1rem;
  }
  
  .selector-info {
    grid-column: 1;
    grid-row: 1;
  }
  
  .preview-container {
    grid-column: 2;
    grid-row: 1 / span 2; /* ocupa ambas filas */
  }
  
  #btn-descarga {
    grid-column: 1;
    grid-row: 2;
  }
  
  .by {
    grid-column: 1;
    grid-row: 3;
  }
}

.by{
  margin: unset;
  text-align: center;
}
.by p{
  margin-bottom: 0;
}
.by a{
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600; 
}
/************************/
/*****GALLERY VIEW*******/
.gallery-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.gallery-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: minmax(min-content, max-content); /* ← Esto resuelve todo */
  gap: 0.25rem;
}
.material-card {
  background: var(-);
  color: var(--text-color);
  border-radius: 1rem;
  padding: 0.5em;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
}
.material-image {
  width: 100%;
  height: 120px; /* Altura fija para todas las imágenes */
}
.material-image img {
  width: 100%;
  height: 100%; /* Ahora sí funciona con object-fit */
  object-fit: contain; /* Mantiene proporciones recortando excedentes */
}
.material-info {
  padding: 0.75rem;
}
.material-info p {
  margin: 0;
  font-weight: 300;
  font-size: 14px;
}



/* Mensaje error */
.error-message {
    text-align: center;
    padding: 2rem;
}


/*************************************/
/**************VIEWER*****************/
/* LAYOUT visualizador 3D */
.viewer3d-container{
  height: 100%;
    display: flex;
  flex-direction: column;

}
.viewer-3d {
    position: relative;
    flex: 1; 
    display: flex;
    height: 100%;
    width: 100%;
    gap: 2rem;
    min-height: 0; 
    align-items: center;
    justify-content: center;
}
      .product-viewer {
          flex: 1;
          width: 100%;
          height: 100%;
          display: flex;
          justify-content: center;
          align-items: center;  
      }
            .product-image {
              height: 100%;
              max-width: 100%;
              object-fit: contain;
            }
      .slider-container {
          position: absolute;
          right: 0;
          display: flex;
          flex-direction: column;
          align-items: center;
          gap: 1rem;
          max-height: 100%;
      }
            .slider-vertical {
                position: relative;
                width: 8px;
                height: 400px;
                max-height: 100%;
                border-radius: 4px;
                border: 1px solid;
                cursor: pointer;
            }
            .slider-track {
                position: absolute;
                width: 100%;
                height: 100%;
            }
            .slider-thumb {
                position: absolute;
                width: 24px;
                height: 24px;
                background: var(--accent-color);
                border-radius: 50%;
                left: -8px;
                transform: translateY(50%);
                cursor: grab;
            }
            .slider-thumb:active {
                cursor: grabbing;
            }
.viewer-options {
  display: flex;
  max-height: 90px;
}
      .options-grid {
        display: grid;
        grid-template-columns: 
          repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
        height: 100%;
      }
      .options-grid img{
        width: 100%;
      }
.error-container {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}
.error-container h2 {
    color: #dc3545;
    margin-bottom: 1rem;
}
.error-container a {
    color: #007bff;
    text-decoration: none;
}
.error-container a:hover {
    text-decoration: underline;
}