/* ============================================
   RESPONSIVE OVERRIDES (tablet/móvil)
   Este archivo sobreescribe `styles.css`.
   ============================================ */

/* ===== Contacto (≤900px) ===== */
@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-hero h1 {
    font-size: 2rem;
  }
}

/* ===== Mapa origen (≤992px) ===== */
@media (max-width: 992px) {
  .map-grid {
    grid-template-columns: 1fr;
  }

  .map-visual {
    margin-top: 30px;
  }
}

/* ===== Tablet (≤992px) ===== */
@media (max-width: 992px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: 0;
  }

  .filtro-toggle {
    display: block;
  }

  .sidebar {
    display: none;
    margin-bottom: 30px;
  }

  .sidebar.activo {
    display: block;
    animation: fadeDown 0.3s ease;
  }

  .trading-flex {
    flex-direction: column;
    gap: 30px;
  }

  .trading-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    padding: 22px;
    margin-top: 20px;
  }

  /* Categorías (tablet) */
  .categoria-card {
    min-width: 280px;
    height: 400px;
  }
}

/* ===== Celular (≤768px) ===== */
@media (max-width: 768px) {
  /* Evitar scroll horizontal y “bandas blancas” en móviles */
  html,
  body {
    overflow-x: hidden;
  }

  /* Hero */
  .hero-venta {
    height: 50vh;
    scroll-margin-top: 160px;
    background-attachment: scroll;
    background-position: center center;
  }

  .trading-hero {
    height: 50vh;
    scroll-margin-top: 160px;
  }

  /* Contorno en texto del hero de trading para móvil */
  .trading-hero .hero-content h1,
  .trading-hero .hero-content p {
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000,
                 0 0 2px #000;
  }

  .hero-slider {
    height: auto;
    aspect-ratio: 16/10;
    min-height: 280px;
    margin-bottom: 30px;
    scroll-margin-top: 160px;
  }

  .hero-slider .hero-slide {
    background-size: cover;
    background-position: center;
  }

  /* Botones del hero de productos en móvil: más visibles */
  .hero-slider .hero-slide .hero-btn {
    padding: 12px 24px;
    font-size: 0.95rem;
    border-radius: 30px;
    background: #fff;
    color: #2e7d32;
    border: 2px solid #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  }
  .hero-slider .hero-slide .hero-btn:hover {
    background: #2e7d32;
    color: #fff;
    border-color: #fff;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-benefits {
    flex-direction: column;
    gap: 10px;
  }

  /* Categorías */
  .categoria-card {
    min-width: 260px;
    height: 360px;
  }

  .cat-arrow {
    display: none;
  }

  .categorias-wrapper {
    cursor: grab;
  }

  .categorias-wrapper.grabbing {
    cursor: grabbing;
  }

  /* Hero slider cards */
  .hero-slide {
    padding: 20px;
    margin-left: 0;
    flex-direction: column;
    text-align: center;
  }

  .slide-productos {
    justify-content: center;
    flex-wrap: wrap;
  }

  .hero-card {
    width: 120px;
  }

  .hero-card img {
    height: 110px;
  }

  /* Ocultar flechas en móvil */
  .hero-arrow,
  .oferta-arrow {
    display: none;
  }

  /* Ofertas carrusel */
  .oferta-carousel-card {
    min-width: 240px;
    height: 280px;
    padding: 0;
  }

  .oferta-carousel-card img {
    height: 160px;
  }

  .hero-slider .hero-slide {
    background-size: contain;
    background-position: center;
  }

  /* Modal (móvil tipo bottom sheet) */
  .modal {
    background-color: white;
    align-items: flex-end;
  }

  .modal-content {
    width: 100%;
    height: 90vh;
    max-width: 100%;
    border-radius: 25px 25px 0 0;
    padding: 25px 20px;
    overflow-y: auto;
    transform: translateY(100%);
    transition: 0.4s ease;
  }

  .modal.active .modal-content {
    transform: translateY(0);
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  /* La imagen del producto se adapta al ancho del modal
     y limita su altura para no romper el layout en móvil */
  .modal-img img {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
  }

  #modalTitulo {
    font-size: 1.4rem;
  }

  .new-price {
    font-size: 1.4rem;
  }

  .old-price {
    font-size: 0.9rem;
  }

  .btn-whatsapp {
    width: 100%;
    text-align: center;
  }

  /* Carrito */
  .cart-drawer {
    width: 100%;
    right: -100%;
  }

  .cart-drawer.active {
    right: 0;
  }

  /* Productos (grid) */
  .productos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .product-card {
    border-radius: 12px;
  }

  .product-img {
    height: 180px;
  }

  .product-body {
    padding: 12px;
  }

  .product-body h3 {
    font-size: 0.85rem;
    min-height: auto;
    margin-bottom: 4px;
  }

  .product-desc {
    font-size: 0.75rem;
    margin-bottom: 8px;
    min-height: auto;
    display: none;
  }

  .product-presentacion {
    font-size: 0.7rem;
    padding: 2px 8px;
    margin-bottom: 4px;
  }

  .price {
    font-size: 1.1rem;
  }

  .product-actions {
    gap: 6px;
    margin-top: 8px;
  }

  .btn-cart,
  .btn-buy {
    padding: 8px;
    font-size: 0.8rem;
  }

  /* Trading */
  .trading-hero {
    height: auto;
    min-height: 60vh;
    padding: 80px 20px;
  }

  .hero-content {
    max-width: 100%;
    padding: 0 10px;
  }

  .hero-content h1 {
    font-size: 32px;
    line-height: 1.2;
  }

  .hero-content p {
    font-size: 16px;
  }
}

/* ===== Smartphone (≤480px) ===== */
@media (max-width: 480px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  p {
    font-size: 14px;
  }

  .btn-primary,
  .btn-outline {
    padding: 12px 24px;
    font-size: 0.9rem;
  }

  .hero-venta h1 {
    font-size: 2rem;
  }

  .hero-venta p {
    font-size: 1rem;
  }

  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Productos */
  .productos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-card {
    border-radius: 10px;
  }

  .product-img {
    height: 160px;
  }

  .product-body {
    padding: 10px;
  }

  .product-body h3 {
    font-size: 0.75rem;
    min-height: auto;
    margin-bottom: 3px;
  }

  .product-desc {
    font-size: 0.7rem;
    margin-bottom: 6px;
    min-height: 20px;
  }

  .product-presentacion {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  .price {
    font-size: 1rem;
  }

  .product-actions {
    gap: 5px;
    margin-top: 6px;
  }

  .btn-cart,
  .btn-buy {
    padding: 6px;
    font-size: 0.75rem;
  }

  /* En smartphone ocultamos badges de categoría y “Nuevo”
     para que la tarjeta se vea más limpia, y también la marca. */
  .badge.categoria,
  .badge.nuevo,
  .product-brand {
    display: none;
  }

  .whatsapp-float {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .contact-hero h1 {
    font-size: 1.5rem;
  }
}

