/* ===========================
📱 RESPONSIVE MOBILE OPTIMIZADO
=========================== */
@media (max-width: 768px) {
  .container {
    padding: 10px;
    margin-left: 8px;
    margin-right: 8px;
  }

  .container h1 {
    text-align: center;
  }

  /* 🔎 BÚSQUEDA COMPACTA */
  .search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    justify-content: space-between;
  }

  .search-form input[type="text"] {
    flex: 1 1 60%;
    min-width: 150px;
    padding: 8px;
    font-size: 1rem;
  }

  .search-form .search-btn {
    flex: 0 0 38px;
    padding: 8px;
    font-size: 1rem;
  }

  .search-form select {
    width: 48%;
    margin-top: 10px;
    font-size: 0.95rem;
  }

  /* 🧱 PRODUCTOS EN 2 COLUMNAS */
  /*El contendor de los productos les dice ordenarse asi */
  .product-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    /* o center si preferís */
    gap: 10px;
  }

  .product-flex {
    background-color: #fff !important;
    border-radius: 6px !important;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.06) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transition: transform 0.2s ease !important;
    cursor: pointer !important;

    flex: 0 1 calc(50% - 10px) !important;
    max-width: calc(50% - 10px) !important;
    margin-bottom: 12px !important;

    /* Cuadrado pero más alto */
    aspect-ratio: 1 / 2 !important;
    height: auto !important;
    max-height: 260px !important;
    min-height: auto !important;

    padding: 12px !important;
  }

  /* 🎯 Productos en página completa (con botones de cantidad + carrito) */
  .product-flex.product-full {
    aspect-ratio: unset !important;
    max-height: none !important;
    height: auto !important;
    min-height: 360px !important;
    /* para asegurar mínimo espacio */
    justify-content: space-between !important;
  }

  .product-flex img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
  }

  .product-inner {
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 3px;
    text-align: center;
    flex-grow: 1;
    min-height: 130px;
  }

  .product-inner img {
    width: 100%;
    height: 85px;
    object-fit: cover;
    border-radius: 4px;
  }

  .product-inner h3 {
    font-size: 0.75rem;
    margin: 4px 0 2px;
    line-height: 1.2;
    font-weight: 600;
  }

  .product-inner p {
    font-size: 0.7rem;
    line-height: 1.2;
    margin: 1px 0;
    color: #444;
    -webkit-line-clamp: 2;
    /* máximo 2 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
  }


  .original-price {
    font-size: 0.65rem;
    color: #d9534f;
    text-decoration: line-through;
    margin: 0;
  }

  .offer-price span,
  .price span {
    font-weight: 600;
    font-size: 0.75rem;
    color: #1d49d8;
  }

  .quantity-control {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 4px;
  }

  .quantity {
    width: 28px;
    height: 30px;
    text-align: center;
    font-size: 0.75rem;
    padding: 3px;
  }

  .quantity-control .btn {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
    padding: 0;
  }

  .btn.add-to-cart {
    font-size: 0.75rem;
    padding: 6px 4px;
    margin-top: 6px;
    width: 100%;
  }

  .share-dropdown {
    top: 6px;
    right: 6px;
    transform: none;
  }

  .custom-select {
    font-size: 0.9rem;
  }

  .view-all {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 20px;
  }

  .view-all .btn {
    width: auto;
    /* 🔥 Esto evita que se estire */
    padding: 8px 16px;
    /* Espaciado agradable */
  }

  /* 🎯 Estilo general */
  .solo-ofertas-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    color: #333;
    margin-top: 5px;
  }

  /* 📱 Para móviles: que se baje solito el solo ofertas check */
  .solo-ofertas-wrap {
    order: 5;
    width: 100%;
    justify-content: flex-start;
    margin-top: 8px;
  }

  .solo-ofertas-wrap label {
    font-size: 0.9rem;
  }

  .solo-ofertas-wrap input[type="checkbox"] {
    accent-color: #1d49d8;
    transform: scale(1.2);
  }






  /* PAGINACIÓN */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    font-size: 13px;
  }

  /* NO PRODUCTS */
  .no-products img {
    width: 100px;
  }

  /* SOBRE NOSOTROS */
  .about-us,
  .contact-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .about-content,
  .about-image,
  .ubicacion,
  .consultation-form-container {
    width: 100%;
  }

  .about-image img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
  }

  iframe {
    height: 220px;
    width: 100%;
  }

  form label,
  form input,
  form textarea,
  form button {
    font-size: 0.95rem;
  }

  .btn,
  button[type="submit"] {
    width: 100%;
    font-size: 1rem;
  }

  .social-media .social-icon {
    font-size: 20px;
    margin: 0 8px;
  }

  /* HEADER NAV MOBILE */
  .nav-links,
  .sesion {
    display: none;
  }

  .hamburger {
    display: block;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
  }

  .header-container {
    justify-content: space-between;
    align-items: center;
  }

  .logo-link {
    flex-grow: 1;
  }

  .mobile-menu {
    display: none;
    flex-direction: column;
    background-color: #fff;
    position: absolute;
    top: 60px;
    right: 20px;
    left: 20px;
    z-index: 1000;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  }

  .mobile-menu a {
    padding: 10px 0;
    color: #1d49d8;
    text-decoration: none;
    font-weight: bold;
  }

  .mobile-menu a:hover {
    text-decoration: underline;
  }

  .mobile-menu.show {
    display: flex;
  }

  /* 🛒 CARRITO */
  .carrito-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
  }

  .carrito-mobile .carrito-info {
    position: relative;
    font-size: 20px;
    color: #333;
    cursor: pointer;
  }

  .carrito-mobile .carrito-info .btn-cart {
    font-size: 22px;
  }

  .carrito-mobile .carrito-count {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    padding: 0.2px 0.2px;
    border-radius: 50%;
    line-height: 1;
    z-index: 1;
  }


  /* Ocultar el otro carrito desktop */
  .sesion .carrito-info {
    display: none !important;
  }




  /* 🌠 SLIDE-IN SIDEBAR */
  .mobile-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 270px;
    height: auto;
    background: #ffffff;
    z-index: 2000;
    padding: 25px 20px;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: right 0.3s ease-in-out;
    font-family: 'Segoe UI', sans-serif;
    border-radius: 2%;
  }

  .mobile-sidebar.show {
    right: 0;
  }

  .close-sidebar {
    background: none;
    border: none;
    font-size: 28px;
    align-self: flex-end;
    color: #333;
    margin-bottom: 15px;
    cursor: pointer;
  }

  .mobile-sidebar a {
    color: #1d49d8;
    font-weight: bold;
    font-size: 1rem;
    text-decoration: none;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    transition: all 0.2s ease;
  }

  .mobile-sidebar a:hover {
    padding-left: 5px;
    color: #1639b0;
  }

  .mobile-sidebar .section-title {
    padding-top: 15px;
    border-top: 1px solid #ccc;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #777;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
  }


  .close-sidebar {
    background: none;
    border: none;
    font-size: 28px;
    align-self: flex-end;
    color: #555;
    margin-bottom: 5px;
    cursor: pointer;
  }

  .top-bar-mobile-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1px;
  }

  .top-bar-mobile-menu .mobile-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: #333;
  }

  .top-bar-mobile-menu .close-sidebar {
    font-size: 28px;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
  }


  /* 📦 Sidebar Carrito - Versión FIX */
  .carrito-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 100%;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    padding: 15px 10px;
  }

  /* Mostrar sidebar */
  .carrito-sidebar.show {
    right: 0;
  }

  /* ❌ Botón cerrar */
  .carrito-sidebar .close-sidebar {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 24px;
    margin-bottom: 10px;
    cursor: pointer;
  }

  /* 🛍️ Ítems de producto */
  .carrito-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 8px;
    background-color: #fff;
    border: 1px solid #ddd;
    margin-bottom: 10px;
  }

  .carrito-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 4px;
  }

  .carrito-item-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-grow: 1;
  }

  .carrito-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    font-size: 0.85rem;
    line-height: 1.2;
    margin-top: 2px;
    min-width: 0;
  }

  /* 📜 Scrollable solo en productos */
  #carrito-items-mobile {
    overflow-y: auto;
    flex: 1;
    padding: 5px;
    box-sizing: border-box;
  }

  /* 📌 Footer fijo con total y botón */
  .carrito-total-footer {
    padding: 15px 10px 10px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
  }

  .total-container {
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .total-container .btn-comprar {
    width: 100%;
    padding: 10px;
    background: #1d49d8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    transition: background 0.3s ease;
  }

  .total-container .btn-comprar:hover {
    background-color: #1639b0;
  }




  .total-container {
    margin-top: auto;
    font-weight: bold;
    padding-top: 10px;
  }

  .total-container .btn-comprar {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background: #1d49d8;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
  }


  /*GALERIA*/
  .slider-window {
    width: 100vw;
    overflow: hidden;
  }

  .slider-track-manual {
    display: flex;
    transition: transform 0.5s ease-in-out;
  }

  .slider-track-manual img {
    flex: 0 0 160vw;
    width: 160vw;
    height: auto;
    aspect-ratio: 393 / 140;
    object-fit: cover;
    object-position: top left;
    /* lo cambiamos para que no interfiera */
    transform: translateX(-30vw);
    /* este es el truco */
  }


}

/* 🌐 OCULTAR MOBILE MENU Y BOTÓN EN VISTA DESKTOP */
@media (min-width: 769px) {

  #mobile-menu,
  .carrito-mobile,
  .mobile-sidebar,
  .carrito-sidebar,
  .hamburger {
    display: none !important;
  }
}