/* ======================================================
   VISOR RA – Estilos base y layout
   ====================================================== */

/* Contenedor de página */
.pagina_visor_ra {
  padding: 5% 10%;
}
/* Viewer principal */
.visor_principal{
  display: flex;
  flex-direction: column;
}
#main-viewer {
  background-color: #3b3b3b;
  width: 100%;
}

/* ======================================================
   Panel "Calculadora" (fijo en desktop / deslizable en mobile)
   ====================================================== */

.calculadora {
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  z-index: 10;
  font-size: 0.9rem;
}

.calculadora label {
  display: block;
  width: 100% !important;
  margin-top: 10px;
}

.calculadora input[type="range"] {
  width: 100%;
  margin-top: 5px;
}

/* Botón de colores/material */
.material-color-button {
  display: inline-block;
  width: 25px;
  height: 25px;
  margin: 3px;
  border: 1px solid #000;             /* ya no necesita !important */
  cursor: pointer;
}

/* ======================================================
   Sección: Explorar productos RA (tarjetas/mini visor)
   ====================================================== */

.explora_productos_ra { margin-top: 50px; }
.explora_titulo { margin-bottom: 20px; }

.explora_lista {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.explora_item {
  display: block;
  text-decoration: none;
  text-align: center;
  background: #fff;
  border-radius: 6px;
  padding: 12px;
  transition: box-shadow .2s ease;
}

.explora_item:hover {
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.explora_viewer_wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f6f6f6;
  border-radius: 10px;
  overflow: hidden;
}

.explora_viewer {
  width: 100%;
  height: 100%;
}

.explora_placeholder {
  width: 100%;
  height: 150px;
  background: #eee;
  border-radius: 10px;
}

.explora_nombre {
  margin-top: 10px;
  font-weight: 600;
  font-size: 14px;
  color: #222;
}

/* ======================================================
   Desktop-only ajustes
   ====================================================== */

@media (min-width: 769px) {
  .explora_item {
    width: 20%;                        /* ancho cómodo para mini visor */
  }
  /* Oculta el botón flotante de mobile si existe en DOM */
  #toggle-calculadora-btn,
  .toggle-explora-ra {
    display: none;
  }
  .explora-overlay { 
    display: none !important; 
  }
  .page_visor_modelos{
  background-color: #e1e1e1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2%;
  }
  .contenedor_principal_visor{
    background-color: white;
    display: flex;
    flex-direction: row-reverse;
    width: 95%;
    padding: 3%;
    border-radius: 15px;
  }
  .mas_modelos{
    width: 70%;
  }
  #main-viewer {
    min-height: 50vh !important;
  }
  .visor_principal_contenedor{
    width: 30%;
  }
}

/* ======================================================
   Mobile (<=768px): paneles deslizables y layout
   ====================================================== */

@media (max-width: 768px) {
  /* Calculadora como panel lateral derecho */
  .calculadora {
    position: fixed;
    top: 0;
    right: -100%;
    width: 90% !important;
    height: 100dvh;
    background: rgba(255,255,255,.7);  /* corregido a rgba */
    border-left: 2px solid #ccc;
    border-radius: 12px 0 0 12px;
    padding: 2rem;
    overflow-y: auto;
    z-index: 999;
    transition: right .3s ease-in-out;
  }
  .calculadora.visible { right: 0; }

  /* Botón flotante para abrir/cerrar calculadora */
  #toggle-calculadora-btn {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: #333;
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    border: 0;
    border-radius: 12px 0 0 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  #toggle-calculadora-btn::after {
    content: "⮞";
    transition: transform .3s ease;
  }
  #toggle-calculadora-btn.open::after {
    transform: rotate(180deg);
  }

  /* Viewer ocupa ancho completo en mobile */
  #main-viewer {
    width: 100%;
    height: 50vh;
  }

  /* ===== Panel "Explora" lateral izquierdo ===== */

  /* Botón flotante (lado izquierdo) */
  .toggle-explora-ra {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translate(-40%, -50%);
    z-index: 1100;
    width: 48px;
    height: 100px;
    border: none;
    border-radius: 0 24px 24px 0;
    background: #111;
    color: #fff;
    font-size: 12px;
    writing-mode: vertical-rl; /* texto vertical opcional */
    text-orientation: mixed;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,.2);
  }
  .toggle-explora-ra.open { background: #333; }

  /* Overlay para el panel de explora */
  .explora-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1090;
  }
  .explora-overlay[hidden] { display: none; }

  /* Panel de explora */
  #explora-panel {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1110;
    width: min(90vw, 360px);
    height: 100dvh;
    background: #fff;
    box-shadow: 6px 0 24px rgba(0,0,0,.18);
    transform: translateX(-100%);
    transition: transform .28s ease;
    padding: 16px;
    overflow-y: auto;
    margin-top: 0; /* anula margen desktop si lo hubiese */
  }
  #explora-panel.visible { transform: translateX(0); }

  /* Grilla interna del panel en mobile */
  #explora-panel .explora_lista {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}
