/* style_clean.css - CON CORRECCIONES RESPONSIVE FINALES Y VISIBILIDAD DE LUPA */
/* Product card + cart + pagination basics (readable, lightly commented) */
.tienda-grid { 
  display: grid; 
  grid-template-columns: repeat(4,1fr); 
  gap: 40px 18px; 
}

/* Product card styling */
.producto-card {
  box-sizing: border-box;
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  padding: 18px 12px 64px; /* leave room for absolute button */
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  min-height: 240px;
  transition: transform .12s ease, box-shadow .12s ease;
}

.producto-card:hover { 
  transform: translateY(-6px); 
  box-shadow: 0 10px 28px rgba(0,0,0,0.08); 
}

.producto-card .carrito-add-btn {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #bcae9e;
  color: #4e3b2c;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 700;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 1px 4px rgba(188,174,158,0.2);
  white-space: nowrap;
}

.producto-card .producto-img { 
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 140px;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
}

.producto-card .producto-nombre { 
  font-size: 1.05rem;
  font-weight: 700;
  color: #4e3b2c;
  margin: 8px 0 6px;
}

.producto-card .producto-precio { 
  color: #388e3c;
  font-weight: 700;
  margin-top: auto;
  margin-bottom: 8px;
  z-index: 1;
}

@media (max-width: 600px) {
  .producto-card {
    min-height: 220px;
    padding: 14px 10px 72px;
  }
  .producto-card .carrito-add-btn {
    bottom: 12px;
  }
  .producto-card .producto-img {
    max-height: 120px;
  }
}

@media (max-width: 900px) {
  .tienda-grid {
    grid-template-columns: repeat(2,1fr); 
  }
}

@media (max-width: 600px) {
  .tienda-grid {
    grid-template-columns: 1fr;
  }
}

.paginacion {
  display:flex;
  justify-content:center; 
  align-items:center; 
  gap:8px; 
  margin:32px 0 16px; 
  padding:6px 12px; 
  overflow-x:auto; 
  white-space:nowrap; 
}

.paginacion button { 
  background:#ede6df; 
  border:none;
  border-radius:8px;
  min-width:36px; 
  height:36px; 
  padding:0 8px; 
  color:#6d4c2b; 
  cursor:pointer; 
}

.paginacion .pagina-activa {
  font-weight:700; 
  color:#4e3b2c; 
  background:rgba(188,174,158,0.2); 
  padding:6px 10px; 
  border-radius:8px; 
}

.paginacion .ellipsis {
  background:transparent; 
  border:none; 
  padding:0 8px; 
  color:#6d4c2b; 
  cursor:pointer; 
}

.carrito-btn { 
  position:fixed; 
  bottom:32px; 
  right:32px; 
  background:#388e3c; 
  color:#fff; 
  border:none; 
  border-radius:50px; 
  padding:14px 28px; 
  font-weight:700; 
  z-index:2000; 
}

.carrito-lista { 
  position:fixed; 
  bottom:80px; 
  right:32px; 
  background:#fff; 
  color:#4e3b2c; 
  border-radius:12px; 
  padding:18px 22px; 
  min-width:320px; 
  max-width:90vw; 
  max-height:60vh; 
  overflow-y:auto; 
  z-index:2001; 
  display:none 
}

.carrito-lista h3 { 
  margin-top:0; 
  margin-bottom:12px; 
  color:#388e3c 
}
.carrito-lista ul { 
  padding-left:0; 
  margin:0 
}

.carrito-lista .carrito-total { 
  font-weight:700; 
  color:#388e3c; 
  margin-top:12px 
}
 
/* End of style_clean.css */

/* Sidebar / categorias */
#sidebar-categorias {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: #f8f5f1;
  box-shadow: -2px 0 12px rgba(188,174,158,0.2);
  z-index: 1000;
  overflow-y: auto;
  transition: right .3s
}

#sidebar-categorias .sidebar-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 18px 8px 18px;
  border-bottom:1px solid #bcae9e;
  background:#ede6df
}

#sidebar-categorias .sidebar-title{
  font-size:1.2em;
  font-weight:700;
  color:#6d4c2b
}

#sidebar-categorias .close-sidebar{
  background:none;
  border:none;
  font-size:1.5em;
  cursor:pointer
}

#sidebar-categorias .sidebar-body{
  padding:18px
}

#sidebar-categorias ul.sidebar-list{
  list-style:none
}

#sidebar-categorias li{
  margin-bottom:8px
}

#sidebar-categorias .cat-toggle{
  background:none;
  border:none;
  font-size:1em;
  color:#6d4c2b;
  cursor:pointer;
  padding:0 4px 0 0
}

#sidebar-categorias a{
  color:#4e3b2c;
  text-decoration:none;
  font-weight:500
}

.subcat-list{
  display:none
}

/* Header / search */
.top-container header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  /* Permitimos que la búsqueda salte de línea si el input se expande mucho */
  flex-wrap: wrap; 
}

.top-container header img{
  height:60px;
  width:auto;
  display:block
}

.search-header{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  height:48px
}

#formBusqueda{
  display:flex;
  align-items:center;
  gap:8px;
  justify-content:center;
  height:48px
}

#searchBtn{
  /* CORRECCIÓN DE LA LUPA: Esencial para que se muestre en la esquina */
  background:none;
  border:none;
  cursor:pointer;
  padding:0;
  outline:none;
  height:40px;
  width:40px;
  display:flex; 
  align-items:center;
  justify-content:center;
  z-index: 10; /* Aseguramos que esté sobre cualquier otro elemento */
  margin-right: 0; /* Aseguramos que no se mueva por márgenes */
}

#searchBtn svg{
  display:block;
  margin:auto
}

/* Search header collapsed/expand behavior */
.search-header{
  position:relative;
  display:flex;
  align-items:center;
  gap:8px;
  flex-grow: 1; /* Permite que el contenedor de búsqueda crezca */
  justify-content: flex-end; /* Alinea la lupa a la derecha */
}

.search-header form{
  display:flex;
  align-items:center;
  gap:8px
}
.search-header input{
  width:0;
  opacity:0;
  padding:6px 8px;
  border-radius:8px;
  border:2px solid transparent;
  transition:width .18s ease,opacity .18s ease,padding .18s ease,border-color .18s ease;
  box-sizing:border-box;
  background:#fff;
  color:#4e3b2c
}

.search-header button{
  background:none;
  border:none;
  cursor:pointer;
  padding:6px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center
}

.search-header:hover input, .search-header.active input, .search-header:focus-within input{
  width:320px;
  opacity:1;
  padding:8px 14px;
  border-color:#e0d6cc
}

.tienda-main h1{
  text-align:center;
  color:#6d4c2b;
  margin-bottom:32px
}

/* placeholder product image (div .producto-img but not img) */
.producto-img:not(img){
  display:flex;
  align-items:center;
  justify-content:center;
  color:#bcae9e
}

/* Carrito remove button in list */
.carrito-remove{
  color:#b71c1c;
  cursor:pointer;
  font-weight:700;
  margin-left:8px
}

/* Product detail page styles moved from inline <style> */
.producto-main{
  max-width:900px;
  margin:0 auto;
  padding:32px 0
}

.producto-box{
  display:flex;
  gap:36px;
  background:#fff;
  border-radius:14px;
  box-shadow:0 2px 16px rgba(0,0,0,0.06);
  padding:32px 24px;
  align-items:flex-start
}

.producto-box .producto-img{
  width:260px;
  height:260px;
  object-fit:contain;
  border-radius:10px;
  background:#f7f5f2;
  box-shadow:0 1px 8px rgba(188,174,158,0.2)
}

@media (max-width:900px){
  .producto-box{
    flex-direction:column;
    align-items:center
  }
  .producto-box .producto-img{
    width:180px;
    height:180px
  }
}
.producto-info{
  flex:1
}

.producto-nombre{
  font-size:2em;
  font-weight:700;
  color:#6d4c2b;
  margin-bottom:10px
}

.producto-precio{
  color:#388e3c;
  font-size:1.4em;
  font-weight:700;
  margin-bottom:18px
}

.producto-categorias{
  color:#bcae9e;
  font-size:1em;
  margin-bottom:18px
}

.producto-desc{
  font-size:1.1em;
  color:#444;
  margin-bottom:18px
}

.producto-stock{
  color:#888;
  font-size:1em;
  margin-bottom:18px
}

.compra-controls{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:8px
}

.compra-controls label{
  font-size:0.95em;
  color:#6d4c2b
}

.cantidad-input{
  width:72px;
  padding:6px;
  border-radius:6px;
  border:1px solid #e0d6cc
}

/* Slider arrow buttons */
#img-prev,#img-next{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  background:#ede6df;
  border:none;
  border-radius:50%;
  width:36px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.5em;
  cursor:pointer;
  z-index:2;
  box-shadow:0 1px 6px rgba(188,174,158,0.2)
}

#img-prev{
  left:-32px
}

#img-next{
  right:-32px
}

/* Small utility / missing selectors moved from inline attributes */
.site-logo{
  height:60px;
  width:auto;
  display:block
}

.producto-media{
  flex:0 0 260px;
  position:relative;
  min-height:260px;
  display:flex;
  align-items:center;
  justify-content:center
}

/* footer tweaks */
.footer-login{
  margin:12px 0
}

/* ===== Global site theme (restore previous look) ===== */
html,body{
  height:100%;
  margin:0;
  padding:0;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background:#f7f5f2;
  color:#4e3b2c;
  -webkit-font-smoothing:antialiased;
  /* CORRECCIÓN: EVITAR DESBORDAMIENTO GLOBAL */
  overflow-x: hidden; 
}
.top-container{
  max-width:1200px;
  margin:0 auto;
  padding:12px 18px;
  /* CORRECCIÓN: Asegurar que el padding no cause desbordamiento */
  box-sizing: border-box;
  width: 100%;
}

.top-container header{
  display:flex;
  align-items:center;
  justify-content:space-between
}

.hamburger{
  display:flex;
  background:none;
  border:none;
  flex-direction:column;
  gap:5px;
  padding:8px;
  cursor:pointer
}

.hamburger span{
  display:block;
  width:22px;
  height:2px;
  background:#6d4c2b;
  border-radius:2px
}

.nav-menu{
  display:none;
  gap:18px;
  align-items:center;
  list-style:none;
  padding:0;
  margin:0
}
.nav-menu li{
  margin:0
}

.nav-menu a{
  color:#4e3b2c;
  text-decoration:none;
  padding:8px 10px;
  border-radius:6px;
  font-weight:600
}

.nav-menu a:hover{
  background:#ede6df
}

.nav-menu.active {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  margin-top: 12px;
}

@media (max-width: 900px) {
  
  .hamburger {
    display: flex;
  }

  /* ESTA REGLA ES CRUCIAL:
    Oculta el menú por defecto en modo móvil.
  */
  .nav-menu {
    display: none;
    width: 100%;
    box-sizing: border-box;
  }

  /* ESTA ES LA REGLA CORREGIDA:
    Muestra el menú (cuando tiene la clase .active) 
    y empuja el contenido hacia abajo.
  */
  
}

.tienda-main{
  max-width:1200px;
  margin:18px auto;
  padding:0 16px;
  /* CORRECCIÓN: Asegurar que el padding no cause desbordamiento */
  box-sizing: border-box;
  width: 100%;
}

.tienda-main h1{
  font-family:inherit;
  font-size:1.9rem;
  margin-bottom:24px
}

.footer-content{
  max-width:1200px;
  margin:24px auto;
  padding:18px;
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  color:#6d4c2b
}

.footer-links a{
  margin-right:14px;
  color:#6d4c2b;
  text-decoration:none
}

.footer-copy{
  font-size:.9em;
  color:#888
}

/* Small utilities */
.text-center{
  text-align:center
}

.hidden{
  display:none !important
}

/* End restore */

/* CORRECCIONES Y AJUSTES FINALES PARA RESPONSIVE (MOBILE) */
.search-header {
  flex-grow: 1; 
  justify-content: flex-end; 
}
.search-header input {
  transition: width .18s ease, opacity .18s ease, padding .18s ease, border-color .18s ease;
}
#formBusqueda {
  justify-content: flex-end;
  width: 100%;
}

@media (min-width: 901px) {
  .search-header:hover input, .search-header.active input, .search-header:focus-within input{
    width:320px;
    opacity:1;
    padding:8px 14px;
    border-color:#e0d6cc
  }
}

@media (max-width: 900px) {
    /* Logo más pequeño y con límite de ancho */
  .top-container header img {
    height: 45px;
    max-width: 120px; 
  }

  #formBusqueda {
    width: 100%;
    justify-content: flex-end; /* Alinea todo a la derecha */
  }

  #searchBtn {
    opacity: 1 !important; 
    width: 40px !important;
    height: 40px !important;
    /* CORRECCIÓN: Deshacemos el padding que pueda ser aplicado por el .search-header button */
    padding: 0 !important; 
    position: relative; /* Asegura que el z-index funcione */
    z-index: 20;
  }
    
  /* Input de búsqueda colapsado a 160px */
  .search-header.active input {
    opacity: 1 !important;
    padding: 8px 14px !important;
    position: absolute; 
    right: 48px; 
    top: 4px;
    left: 0px; /* Deja espacio para el menú hamburguesa */
    border-color: #6d4c2b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: auto;
  }

  .top-container header {
    gap: 10px;
  }
    
  /* Ajuste de Carrito para evitar desbordamiento */
  .carrito-btn {
    right: 15px;
    bottom: 15px;
    padding: 10px 20px;
    font-size: 0.9em;
  }

  .carrito-lista {
    right: 15px;
    bottom: 60px;
    min-width: 280px;
    max-width: calc(100vw - 30px); 
    left: auto; 
  }

  /* Ajuste de contenedores para asegurar que el padding no desborde */
  .tienda-main, .top-container {
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Sidebar en pantallas extra pequeñas */
  #sidebar-categorias {
    width: 100%;
    max-width: 300px; 
    right: -100vw; 
  }
}
/* --- ESTILOS PARA EL AVISO (TOAST) DE AÑADIR AL CARRITO --- */
.cart-toast {
  visibility: hidden; /* Oculto por defecto */
  min-width: 250px;
  max-width: 90vw;
  background-color: #388e3c; /* Color de éxito */
  color: #fff;
  text-align: center;
  border-radius: 8px;
  padding: 16px 24px;
  position: fixed;
  z-index: 3000;
  left: 50%;
  transform: translateX(-50%);
  bottom: 30px;
  font-size: 1.05em;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Clase 'show' que añade JavaScript para mostrarlo */
.cart-toast.show {
  visibility: visible;
  /* Animación: 0.5s para aparecer, 2s visible, 0.5s para desaparecer */
  animation: toast-fade-in 0.5s, toast-fade-out 0.5s 2.5s;
}

/* Animación de entrada */
@keyframes toast-fade-in {
  from {bottom: 0; opacity: 0;}
  to {bottom: 30px; opacity: 1;}
}

/* Animación de salida */
@keyframes toast-fade-out {
  from {bottom: 30px; opacity: 1;}
  to {bottom: 0; opacity: 0;}
}

/* --- Estilos para Submenú Desplegable --- */

/* Contenedor del link + botón */
.submenu-toggle-wrapper {
    display: flex;
    justify-content: space-between; /* Pone el link a la izq y el botón a la der */
    align-items: center;
    width: 100%;
}

/* El link principal (Kits de Robots) */
.submenu-toggle-wrapper a {
    flex-grow: 1; /* Hace que el link ocupe el espacio */
    /* Hereda los estilos de .nav-menu a */
}

/* El botón de la flecha */
.submenu-toggle-btn {
    background: none;
    border: none;
    color: #6d4c2b; /* Color del ícono */
    font-size: 1em;
    padding: 8px 12px; /* Área de clic */
    cursor: pointer;
    border-radius: 6px;
    line-height: 1;
}
.submenu-toggle-btn:hover {
    background: #ede6df; /* Mismo hover que los links */
}

/* El <ul> del submenú (OCULTO POR DEFECTO) */
.nav-menu ul.submenu {
    list-style: none;
    padding: 0 0 0 25px; /* Mantiene la indentación */
    margin: 0;
    display: none; /* ¡OCULTO! */
}

/* El enlace <a> del submenú (Mantenemos el ↳) */
.nav-menu ul.submenu a {
    padding: 6px 10px;
    font-size: 0.95em;
    font-weight: 500;
    color: #4e3b2c;
    display: block;
}

.nav-menu ul.submenu a::before {
    content: "↳ "; 
    color: #6d4c2b;
    font-weight: bold;
}