/* ============================================
   QUINCATOUS.COM — Responsive Mobile CSS (CORREGIDO)
   OpenCart 4.x — Harmonizado con custom.css
   Autor: corregido y optimizado
   ============================================

   ORDEN DE CARGA EN header.twig:
   1. custom.css      (estilos base)
   2. responsive.css  (este archivo — siempre al final)
   ============================================ */


/* ============================================
   TABLET — 768px a 991px
   ============================================ */
@media (min-width: 768px) and (max-width: 991px) {

  /* Grid: 3 columnas tablet */
  .product-layout {
    width: 33.333% !important;
	flex: 0 0 33.33% !important;
    float: left !important;
    padding: 8px !important;
  }

  /* Header: reducir padding */
  #header {
    padding: 10px 0 !important;
  }

  /* Ocultar botones de acción en tarjetas de producto en móvil */
  .product-thumb .button-group {
    display: none !important;
  }
}


/* ============================================
   MÓVIL — hasta 767px
   ============================================ */
@media (max-width: 767px) {

  /* --- BASE --- */
  body {
    font-size: 14px !important;
    overflow-x: hidden !important;
    /* Mantiene el background de custom.css: #f2f2f2 */
  }

  /* Contenedores full-width */
  .container,
  .row {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }


  /* --- TOP BAR --- */
  /* NOTA: custom.css pone #header en sticky (z-index 1000).
     No duplicar sticky en #top para evitar doble barra fija.
     En OpenCart, #top es la barra superior (cuenta/idioma)
     y #header es el bloque logo+search+cart.
     Solo #header necesita ser sticky. */
  #top {
    position: static !important; /* Evita conflicto con #header sticky */
    text-align: center !important;
    padding: 5px 12px !important;
  }

  /* Ocultar elementos de topbar no esenciales en móvil */
  #top .pull-left,
  #top .pull-right {
    float: none !important;
    text-align: center !important;
  }


  /* --- HEADER --- */
  /* #header ya es sticky por custom.css — solo ajustamos layout */
  #header {
    padding: 10px 12px !important;
  }

  #logo {
    text-align: center !important;
    float: none !important;
    display: block !important;
    margin: 0 auto 10px auto !important;
  }

  #logo img {
    max-height: 55px !important;
    transform: none !important; /* Anula translateY(5px) en móvil */
  }


  /* --- BUSCADOR --- */
  #search {
    width: 100% !important;
    float: none !important;
    clear: both !important;
    margin: 8px 0 !important;
    display: flex !important;
    transform: none !important; /* Anula translateY(5px) del custom.css */
  }

  #search input {
    flex: 1 !important;
    min-width: 0 !important;
  }


  /* --- CARRITO FLOTANTE --- */
  /* Movido a botón flotante (FAB) en móvil */
  #cart {
    position: fixed !important;
    bottom: 20px !important;
    right: 16px !important;
    z-index: 9999 !important;
    float: none !important;
  }

  #cart > button {
    width: 52px !important;
    height: 52px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 16px rgba(249,115,22,0.45) !important;
    /* Mantiene background: orange del custom.css */
  }

  /* El dropdown del cart debe abrirse hacia ARRIBA en móvil */
  #cart .dropdown-menu {
    top: auto !important;
    bottom: 60px !important;
    right: 0 !important;
    left: auto !important;
    min-width: 280px !important;
    max-width: calc(100vw - 32px) !important;
  }

  /* Ocultar texto del carrito, solo icono */
  #cart-total { display: none !important; }
  #cart i { font-size: 18px !important; }


  /* --- NAVBAR / MENÚ --- */
  nav#menu {
    border-top: 1px solid #383838 !important;
	font-weight: bold;
	font-size: 20px !important;
	padding: 6px 10px !important;
  }

  /* Botón hamburguesa */
  nav#menu .navbar-toggle {
    display: block !important;
    margin: 8px 0 !important;
    background: transparent !important;
    border: 1px solid #f97316 !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
  }

  nav#menu .navbar-toggle .icon-bar {
    background: #f97316 !important;
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px 0;
  }

  /* Menú desplegado en móvil */
  nav#menu .navbar-collapse {
    padding: 0 !important;
  }

  nav#menu .navbar-nav > li > a {
    border-right: none !important;           /* Anula border-right: 15px del custom.css */
    border-bottom: 1px solid #383838 !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }

  nav#menu .dropdown-menu {
    position: static !important;
    float: none !important;
    width: 100% !important;
    border-top: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  nav#menu .dropdown-menu a {
    padding: 10px 28px !important;          /* Indentado para indicar subcategoría */
    font-size: 13px !important;
  }


  /* --- SIDEBAR CATEGORÍAS --- */
  /* En móvil el sidebar se mueve arriba del contenido */
  #column-left {
    width: 100% !important;
    float: none !important;
    margin-bottom: 20px !important;
    border-radius: 0 !important;
  }

  /* Colapsar categorías por defecto en móvil */
  #column-left .list-group {
    max-height: 200px;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  #column-left .list-group.expanded {
    max-height: 9999px;
  }


  /* --- GRID DE PRODUCTOS — 2 columnas --- */
  .product-layout {
    width: 50% !important;
    float: left !important;
    padding: 5px !important;
    box-sizing: border-box !important;
  }

  /* Clearfix para la grid */
  .row {
        display: flex !important;
        flex-wrap: wrap !important;
    }

  /* Tarjeta en móvil */
  .product-thumb {
    margin-bottom: 10px !important;
  }

  .product-thumb .image img {
    width: 100% !important; /* Fuerza a la imagen a ocupar todo el ancho de la columna */
    height: auto !important;
    object-fit: contain !important;
    padding: 8px !important;
  }

  .product-thumb h4 {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }

  .product-thumb p {
    display: none !important;             /* Ocultar descripción en móvil */
  }

  /* Precio en tarjeta móvil */
  .price {
    font-size: 16px !important;
  }


  /* --- BREADCRUMB --- */
  /* Ya tiene display:none en custom.css para .hidden-xs.
     Lo ocultamos también aquí para mayor compatibilidad */
  .breadcrumb {
    display: none !important;
  }


  /* --- PÁGINA PRODUCTO INDIVIDUAL --- */
  #product {
    padding: 0 !important;
  }

  /* Imagen producto: ocupa toda la pantalla */
  #product #content .col-sm-8,
  #product #content .col-md-8 {
    width: 100% !important;
    padding: 0 !important;
  }

  #product .thumbnails img {
    max-height: 60px !important;
  }

  #product .price {
    font-size: 22px !important;
  }

  #product .btn-primary {
    width: 100% !important;
    padding: 14px !important;
    font-size: 15px !important;
    margin-bottom: 8px !important;
  }


  /* --- CHECKOUT / FORMULARIOS --- */
  .form-control {
    font-size: 16px !important;   /* Evita zoom automático en iOS (mínimo 16px) */
  }

  /* Steps del checkout apilados */
  #checkout-cart .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }


  /* --- FOOTER --- */
  footer {
    padding: 32px 12px 80px !important; /* 80px inferior = espacio para el cart FAB */
  }

  footer .col-sm-3,
  footer .col-md-3 {
    width: 100% !important;
    float: none !important;
    margin-bottom: 24px !important;
    border-bottom: 1px solid #383838 !important;
    padding-bottom: 16px !important;
  }

  footer .col-sm-3:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
  }


  /* --- TABLA CARRITO / CHECKOUT --- */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 16px !important;
  }

  .table > tbody > tr > td {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }


  /* --- PAGINACIÓN --- */
  .pagination {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px !important;
  }

  .pagination > li > a,
  .pagination > li > span {
    padding: 7px 12px !important;
    font-size: 13px !important;
  }

}


/* ============================================
   MÓVILES MUY PEQUEÑOS — hasta 380px
   ============================================ */
@media (max-width: 380px) {

  /* 1 sola columna en pantallas muy pequeñas */
  .product-layout {
    width: 100% !important;
    float: none !important;
  }

  .product-thumb .image img {
    height: 160px !important;
  }

  .product-thumb h4 {
    font-size: 13px !important;
  }

  .price {
    font-size: 18px !important;
  }

  /* Carrito FAB más pequeño */
  #cart > button {
    width: 46px !important;
    height: 46px !important;
  }
}