/*
 * La Superior — mejora responsiva (propuesta B)
 * Se carga después de estilos.css y estilosnuevos.css para evitar modificar
 * los estilos originales y facilitar la reversión.
 */

:root {
  --ls-cafe: #4c372b;
  --ls-crema: #fbf7f1;
  --ls-borde: rgba(76, 55, 43, .12);
  --ls-sombra: 0 8px 24px rgba(47, 31, 20, .09);
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { max-width: 100%; overflow-x: clip; }
img, video, iframe { max-width: 100%; }

/* Navegación con mejor jerarquía y un menú móvil más cómodo */
.navbar.bg-light {
  position: relative;
  z-index: 100;
  background: rgba(255,255,255,.98) !important;
  box-shadow: 0 3px 18px rgba(76,55,43,.07);
}
.navbar .navbar-brand { min-width: 0; }
.navbar .nav-link {
  font-size: .91rem;
  letter-spacing: .035em;
  transition: color .2s ease, background-color .2s ease;
}
.navbar .nav-link:hover,
.navbar .nav-link:focus { color: #9a5934 !important; }
.navbar-toggler { border-color: rgba(76,55,43,.22); box-shadow: none !important; }
.navbar-toggler:focus { outline: 2px solid rgba(154,89,52,.25); outline-offset: 2px; }

/* Portada / carrusel / cintillos */
#miCarrusel {
  width: 100%;
  overflow: hidden;
  border-radius: clamp(12px, 2vw, 28px);
  box-shadow: var(--ls-sombra);
}
#miCarrusel .carousel-inner { border-radius: inherit !important; overflow: hidden; }
#miCarrusel .carousel-item img { display: block; width: 100%; height: auto; }
#miCarrusel .carousel-control-prev,
#miCarrusel .carousel-control-next { width: 9%; }
#miCarrusel .carousel-control-prev-icon,
#miCarrusel .carousel-control-next-icon {
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.55));
}
body .container > div[style*="width: 100%"] > img,
body .container > div[style*="width: 100%"] > a > img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: clamp(12px, 2vw, 28px) !important;
}

/* Tarjetas: espaciado más limpio, imágenes consistentes y texto legible */
.nuevos { width: 100%; overflow: hidden; }
.nuevos > .container { width: 100%; }
.producto { min-width: 0; }
.producto img { max-width: 100%; height: auto; }
.producto > img {
  display: block;
  width: 100%;
  border-radius: 20px !important;
  object-fit: cover;
}
.producto h2 { line-height: 1.3; overflow-wrap: anywhere; }
.producto p { line-height: 1.65; overflow-wrap: anywhere; }
.producto a { transition: transform .2s ease, opacity .2s ease; }
.producto a:hover { opacity: .9; transform: translateY(-1px); }
.producto a img { vertical-align: middle; }

/* Pie de página: evitar columnas estrechas y textos diminutos */
.fondoM { gap: 18px; align-items: center; }
.fondoM .parte { min-width: 0; }
.fondoM .parte h1,
.fondoM .parte h2,
.fondoM .parte h3 { line-height: 1.5; }
.logocom { max-width: 100%; height: auto; }
.iconof, .iconof2 { max-width: 100%; height: auto; }

/* Botón flotante de WhatsApp */
.btn-flotante {
  z-index: 1050;
  transition: transform .2s ease, filter .2s ease;
}
.btn-flotante:hover { transform: translateY(-2px); }
.btn-flotante img { display: block; max-width: 100%; height: auto; }

/* Ventanas modales y contenido de productos */
.modal-content { overflow: hidden; border: 0; border-radius: 18px; box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.modal-header { position: relative; }
.modal-body { overflow-wrap: anywhere; }
.imagenPan img { display: block; max-width: 100%; height: auto; object-fit: contain; }
.datosModal h1 { line-height: 1.2; }
.datosModal p { line-height: 1.65; }
.pedidos img { max-width: 100%; height: auto; }
.cierreM { cursor: pointer; }

/* Tablets y teléfonos grandes */
@media (max-width: 991.98px) {
  .navbar { padding: 10px 16px; }
  .navbar .container-fluid { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 0; }
  .navbar .navbar-brand { display: block; width: min(72%, 300px); max-width: calc(100% - 64px); margin: 0; }
  .navbar .logoMenu { display: block; position: static !important; width: 100% !important; max-width: 100%; height: auto; object-fit: contain; }
  .navbar .navbar-toggler { flex: 0 0 auto; margin-left: auto; padding: 7px 9px; }
  .navbar .navbar-collapse { flex-basis: 100%; width: 100%; margin-top: 8px; }
  .navbar .navbar-nav { width: 100%; margin: 0 !important; padding: 8px 0 2px; }
  .navbar .nav-item { width: 100%; border-top: 1px solid var(--ls-borde); }
  .navbar .nav-link { display: block; padding: 13px 8px; font-size: .95rem; }
  .navbar .nav-link:active { background: var(--ls-crema); }
  .nuevos > .container { max-width: 100%; }
}

/* Móvil: prioridad a legibilidad, espacios táctiles y evitar desbordamientos */
@media (max-width: 767.98px) {
  .BarraM { position: relative; overflow: hidden; }
  .BarraM > img { display: block; width: 100%; height: auto; min-height: 0; object-fit: cover; }
  .BarraM .iconos { z-index: 2; }
  .BarraM .iconos img { width: clamp(22px, 6vw, 30px); height: auto; }

  body > .container,
  body .container { padding-right: 14px; padding-left: 14px; }
  #miCarrusel { margin-top: 14px !important; border-radius: 14px; }
  #miCarrusel .carousel-control-prev,
  #miCarrusel .carousel-control-next { width: 13%; }

  .nuevos { margin-top: 24px; }
  .nuevos > .container { padding-right: 0; padding-left: 0; }
  .producto {
    float: none !important;
    width: 100% !important;
    margin: 0 0 28px !important;
    padding: 0 !important;
    text-align: left;
  }
  .producto > img { width: 100% !important; margin-bottom: 16px !important; border-radius: 16px !important; }
  .producto h1, .producto h2, .producto h3, .producto p {
    width: 100% !important;
    max-width: 100%;
    float: none !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    text-align: left !important;
  }
  .producto h2 { margin-top: 0; margin-bottom: 10px; font-size: clamp(1.2rem, 5vw, 1.55rem) !important; }
  .producto h3 { margin: 0 !important; }
  .producto p { margin-top: 10px; margin-bottom: 16px; font-size: 1rem !important; line-height: 1.65 !important; }
  .producto a { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; font-size: .95rem; line-height: 1.4; }
  .producto a img { width: 30px !important; height: auto; flex: 0 0 30px; }

  .fondoM { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 28px 18px calc(28px + env(safe-area-inset-bottom, 0px)); text-align: center; }
  .fondoM .parte { float: none !important; width: 100% !important; margin: 0 !important; text-align: center !important; }
  .fondoM .parte h1 { font-size: .78rem !important; line-height: 1.6 !important; }
  .fondoM .parte h2 { font-size: .9rem !important; line-height: 1.5 !important; }
  .fondoM .parte h3 { font-size: 1rem !important; line-height: 1.5 !important; }
  .logocom { width: 150px !important; max-width: 65%; }
  .iconof, .iconof2 { width: 34px !important; height: auto; margin: 4px; }

  .btn-flotante { right: 14px !important; bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important; padding: 5px !important; border-radius: 50%; }
  .btn-flotante img { width: 48px !important; height: auto; }

  .modal-dialog { margin: 12px !important; }
  .modal-content { max-height: calc(100dvh - 24px); border-radius: 15px; }
  .modal-body { padding: 15px; }
  .modal-header { padding: 14px 15px; }
  .modal-title { padding-right: 30px; font-size: 1rem; }
  .modal-body h1 { font-size: 1.35rem; }
  .modal-body h4 { font-size: .95rem !important; line-height: 1.65; text-align: left !important; }
  .imagenPan img { width: 100%; max-height: 44vh; object-fit: contain; }
  .datosModal p { font-size: .95rem; line-height: 1.6; }
  .pedidos { text-align: center; }
  .pedidos img { width: min(70%, 230px); }
  .cierreM { width: 26px !important; height: auto; }

  .productoPan, .productoPanT { max-width: 100%; }
  .productoPan img, .productoPanT img { max-width: 100%; height: auto; }
  .sucursales { min-height: 0; height: auto !important; }
  .datos { height: auto !important; min-height: 0; padding-bottom: 16px; }
}

@media (max-width: 380px) {
  .navbar { padding-right: 12px; padding-left: 12px; }
  .navbar .navbar-brand { width: min(68%, 245px); }
  .producto h2 { font-size: 1.15rem !important; }
  .producto p { font-size: .94rem !important; }
  .btn-flotante img { width: 44px !important; }
  .fondoM { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Integración con estilosnuevos.css: categorías y botones de panes */
.menucategorias {
  height: auto !important;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  overflow: visible;
}
.imagencategoria {
  min-width: 0;
  box-sizing: border-box;
}
.imagencategoria img {
  display: block;
  box-sizing: border-box;
  max-width: 100%;
}
.botonPanes2 img {
  max-width: 100%;
  height: auto;
}

/* Evita que la altura fija del carrusel de estilosnuevos.css afecte al móvil */
@media (max-width: 767.98px) {
  .carousel-inner,
  #miCarrusel .carousel-inner {
    height: auto !important;
  }
  .carousel-item {
    height: auto !important;
  }
  .carousel-item > img,
  .carousel-item img {
    width: 100%;
    height: auto !important;
    object-fit: contain;
  }

  .menucategorias {
    width: 100% !important;
    height: auto !important;
    margin: 8px 0 18px;
  }
  .imagencategoria {
    width: 50% !important;
    height: auto !important;
    float: none !important;
    padding: 6px !important;
  }
  .imagencategoria img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    object-fit: cover !important;
    padding: 0 !important;
    border-radius: 14px !important;
  }
  .botonPanes2 {
    float: none !important;
    margin: 18px 0 !important;
  }
  .botonPanes2 img {
    width: min(58%, 250px) !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .menucategorias {
    height: auto !important;
  }
  .imagencategoria {
    width: 33.333% !important;
    height: auto !important;
    float: none !important;
    padding: 8px !important;
  }
  .imagencategoria img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    padding: 0 !important;
    border-radius: 16px !important;
  }
  .carousel-inner,
  #miCarrusel .carousel-inner {
    height: auto !important;
  }
  .carousel-item > img,
  .carousel-item img {
    height: auto !important;
  }
}

@media (max-width: 380px) {
  .imagencategoria { padding: 4px !important; }
  .imagencategoria img { border-radius: 11px !important; }
}
