/* MASI Mobile 1.7.5 — carrito, resumen y ventana de "Producto añadido" (solo móvil)
 * Misma jerarquía que el pago: texto normal, etiquetas en seminegrita, totales en negrita. */
@media (max-width: 767px) {
  /* Botón negro de "volver arriba": la app ya tiene su navegación */
  #back-to-top, .back-to-top { display: none !important; }

  /* ---- Líneas de resumen (carrito, pago y ventana) ---- */
  .cart-summary-line,
  .cart-summary-line .label,
  .cart-summary-line .value {
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
    color: var(--masi-ink) !important;
    line-height: 1.5 !important;
  }
  .cart-summary-line .label { color: var(--masi-muted) !important; }
  .cart-summary-line.cart-total .label,
  .cart-summary-totals .cart-total .label,
  .cart-total .label {
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
  }
  .cart-summary-line.cart-total .value,
  .cart-summary-totals .cart-total .value,
  .cart-total .value {
    font-size: var(--masi-fs-lg) !important;
    font-weight: 700 !important;
  }
  .cart-summary-line small,
  .cart-summary-line .sub { font-size: var(--masi-fs-xs) !important; }

  /* Código promocional en píldora */
  .block-promo .promo-input,
  .promo-code .promo-input,
  .block-promo input[name="discount_name"] {
    height: 46px !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-radius: 23px !important;
    background: #fff !important;
    font-size: var(--masi-fs-md) !important;
  }
  .block-promo button,
  .promo-code button {
    height: 46px !important;
    padding: 0 18px !important;
    border: 0 !important;
    border-radius: 23px !important;
    background: var(--masi-ink) !important;
    color: #fff !important;
    font-size: var(--masi-fs-sm) !important;
    font-weight: 600 !important;
  }

  /* ---- Página del carrito ---- */
  body#cart #wrapper .card,
  body#cart #wrapper .cart-container,
  body#cart #wrapper .cart-summary {
    border: 0 !important;
    box-shadow: none !important;
  }
  body#cart #wrapper .cart-summary {
    border-radius: 20px !important;
    background: var(--masi-bg) !important;
    overflow: hidden;
  }
  body#cart #wrapper .cart-summary .card-block { border-color: #fff !important; }
  body#cart #wrapper .cart-item {
    padding: 14px 0 !important;
    border-bottom: 1px solid var(--masi-line) !important;
  }
  body#cart #wrapper .product-line-info a.label,
  body#cart #wrapper .product-line-grid-body .label {
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
  }
  body#cart #wrapper .product-line-info .value,
  body#cart #wrapper .product-line-grid-body .current-price,
  body#cart #wrapper .product-line-grid-body .price,
  body#cart #wrapper .product-line-grid-body .product-price {
    color: var(--masi-muted) !important;
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
  }
  body#cart #wrapper .product-line-grid-right .product-price,
  body#cart #wrapper .product-line-grid-right .product-price strong {
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 700 !important;
  }
  body#cart #wrapper .remove-from-cart,
  body#cart #wrapper .remove-from-cart i { color: var(--masi-muted) !important; }
  body#cart #wrapper .cart-items .bootstrap-touchspin .input-group-btn-vertical { display: none !important; }
  body#cart #wrapper .cart-items .bootstrap-touchspin {
    border: 0 !important;
    background: transparent !important;
    width: auto !important;
  }

  /* Recuadro de "Entrega estimada" sin borde */
  body#cart #wrapper .estimateddelivery,
  body#product #wrapper .estimateddelivery {
    margin: 0 0 14px !important;
    padding: 14px 16px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: var(--masi-bg) !important;
  }
  body#cart #wrapper .estimateddelivery,
  body#cart #wrapper .estimateddelivery *,
  body#product #wrapper .estimateddelivery,
  body#product #wrapper .estimateddelivery * {
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
  }
  body#cart #wrapper .estimateddelivery strong,
  body#cart #wrapper .estimateddelivery b,
  body#product #wrapper .estimateddelivery strong,
  body#product #wrapper .estimateddelivery b,
  body#cart #wrapper .estimateddelivery .page-subheading { font-weight: 600 !important; }

  /* Aviso de portes gratis del tema: en una línea de texto normal (y oculto si está el del módulo) */
  .iqitfreedeliverycount,
  .iqitfreedeliverycount * {
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
  }
  .iqitfreedeliverycount p,
  .iqitfreedeliverycount span,
  .iqitfreedeliverycount strong { display: inline !important; }
  .iqitfreedeliverycount strong { font-weight: 600 !important; }
  body.masi-has-freeship .iqitfreedeliverycount { display: none !important; }

  /* Productos recomendados del carrito */
  body#cart #wrapper .product-miniature .product-title a {
    font-size: var(--masi-fs-sm) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
  }
  body#cart #wrapper .product-miniature .product-price {
    font-size: var(--masi-fs-md) !important;
    font-weight: 700 !important;
  }
  body#cart #wrapper .swiper-button-next,
  body#cart #wrapper .swiper-button-prev {
    width: 36px !important;
    height: 36px !important;
    border-radius: 18px !important;
    background: rgba(22, 24, 29, .85) !important;
  }

  /* ---- Ventana "Producto añadido" ---- */
  #blockcart-modal .modal-content { border: 0 !important; border-radius: 22px 22px 0 0 !important; }
  #blockcart-modal,
  #blockcart-modal *:not(.fa):not(.material-icons) { font-family: var(--masi-font) !important; }
  #blockcart-modal .modal-title,
  #blockcart-modal .modal-header h4 {
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
  }
  #blockcart-modal .product-name,
  #blockcart-modal .product-name a {
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
  }
  #blockcart-modal .product-price,
  #blockcart-modal .product-quantity,
  #blockcart-modal .product-quantity * {
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
  }
  /* "There is 1 item in your cart": repetido y sin traducir en el tema */
  #blockcart-modal .cart-products-count { display: none !important; }
  /* Cada línea: concepto a la izquierda e importe a la derecha */
  #blockcart-modal .cart-content > p,
  #blockcart-modal .cart-content-subtotals > p,
  #blockcart-modal .cart-content .cart-subtotals > p {
    display: flex !important;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 4px !important;
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
  }
  #blockcart-modal .cart-content > p strong,
  #blockcart-modal .cart-content .label { color: var(--masi-muted) !important; font-weight: 400 !important; font-size: var(--masi-fs-sm) !important; }
  #blockcart-modal .cart-content > p.product-total,
  #blockcart-modal .cart-content > p.product-total strong,
  #blockcart-modal .cart-content > p:last-of-type,
  #blockcart-modal .cart-content > p:last-of-type strong {
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 700 !important;
  }
  #blockcart-modal .cart-content-btn .btn,
  #blockcart-modal .cart-content .btn {
    width: 100%;
    min-height: 52px;
    margin: 6px 0 0 !important;
    border-radius: 26px !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 700 !important;
    text-transform: none !important;
  }
  #blockcart-modal h3,
  #blockcart-modal h4,
  #blockcart-modal .h3,
  #blockcart-modal .section-title {
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
  }
}

/* ===================== 1.7.6 · Ajustes de espaciado y legibilidad ===================== */
@media (max-width: 767px) {
  /* ---- Carrito: bloques alineados y con la misma separación ---- */
  body#cart #wrapper .cart-grid-right > *,
  body#cart #wrapper .cart-grid-body > * { margin-bottom: 14px !important; }

  /* Entrega estimada: una sola tarjeta (sin el recuadro interior del módulo) */
  body#cart #wrapper .estimateddelivery,
  body#product #wrapper .estimateddelivery {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }
  body#cart #wrapper .estimateddelivery *,
  body#product #wrapper .estimateddelivery * {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  body#cart #wrapper .estimateddelivery > *,
  body#product #wrapper .estimateddelivery > * { padding: 0 !important; }
  body#cart #wrapper .estimateddelivery p,
  body#product #wrapper .estimateddelivery p { margin: 0 0 4px !important; }

  /* Resumen: mismo margen interior en todas las filas */
  body#cart #wrapper .cart-summary .card-block,
  body#cart #wrapper .cart-summary .cart-detailed-actions,
  body#cart #wrapper .cart-summary .block-promo { padding-left: 16px !important; padding-right: 16px !important; }

  /* Totales: la fila del total destaca, el resto igual que las demás líneas */
  html body .cart-summary-totals .cart-summary-line .label,
  html body .cart-summary-totals .cart-summary-line .value {
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
  }
  html body .cart-summary-totals .cart-summary-line.cart-total .label,
  html body .cart-summary .cart-summary-line.cart-total .label {
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
    color: var(--masi-ink) !important;
  }
  html body .cart-summary-totals .cart-summary-line.cart-total .value,
  html body .cart-summary .cart-summary-line.cart-total .value {
    font-size: var(--masi-fs-lg) !important;
    font-weight: 700 !important;
  }

  /* Código promocional: icono, campo y botón separados y centrados */
  html body .block-promo .promo-code form,
  html body .block-promo form {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
  }
  html body .block-promo .promo-input { flex: 1 1 auto; min-width: 0; margin: 0 !important; }
  html body .block-promo button { flex: 0 0 auto; margin: 0 !important; }
  html body .block-promo .promo-code-button,
  html body .block-promo .collapse-button { font-size: var(--masi-fs-sm) !important; font-weight: 500 !important; }

  /* En el carrito ya está "Consultar este pedido por WhatsApp": fuera el flotante */
  body#cart #masi-wa { display: none !important; }

  /* ---- Filtros del listado: píldoras pequeñas en una fila deslizable ---- */
  html body #facets_search_center_dropdown,
  html body #js-product-list-top + #facets_search_center_dropdown { margin: 4px 0 18px !important; }
  html body #facets_search_center_dropdown #search_filters,
  html body #facets_search_center_dropdown .facets-row,
  html body #facets_search_center_dropdown > div {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 4px !important;
    margin: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    scrollbar-width: none;
  }
  html body #facets_search_center_dropdown ::-webkit-scrollbar { display: none; }
  html body #facets_search_center_dropdown .facet,
  html body #facets_search_center_dropdown .facet-dropdown {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html body #facets_search_center_dropdown .facet .form-control,
  html body #facets_search_center_dropdown .select-title,
  html body #facets_search_center_dropdown .dropdown-toggle,
  html body #facets_search_center_dropdown .facet-title,
  html body #facets_search_center_dropdown button {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    height: 38px !important;
    min-height: 0 !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 19px !important;
    background: var(--masi-bg) !important;
    box-shadow: none !important;
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-sm) !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    white-space: nowrap;
  }
  /* Espacio entre filtros y productos */
  html body #js-product-list { margin-top: 6px !important; }

  /* ---- Ventana "Producto añadido": importes legibles (el JS separa concepto e importe) ---- */
  html body .modal .cart-content p.masi-line,
  html body #blockcart-modal p.masi-line {
    display: flex !important;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 6px !important;
  }
  html body .modal p.masi-line .masi-line__label,
  html body .modal p.masi-line strong {
    color: var(--masi-muted) !important;
    font-size: var(--masi-fs-sm) !important;
    font-weight: 400 !important;
  }
  html body .modal p.masi-line .masi-line__value {
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
    white-space: nowrap;
  }
  html body .modal p.masi-line.is-total .masi-line__label,
  html body .modal p.masi-line.is-total strong {
    color: var(--masi-ink) !important;
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
  }
  html body .modal p.masi-line.is-total .masi-line__value {
    font-size: var(--masi-fs-lg) !important;
    font-weight: 700 !important;
  }
  html body .modal .masi-hidden-count { display: none !important; }
  html body .modal .modal-title,
  html body .modal .modal-header h4 {
    font-size: var(--masi-fs-md) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
  }
  html body .modal .product-name,
  html body .modal .product-name a { font-size: var(--masi-fs-md) !important; font-weight: 600 !important; line-height: 1.35 !important; }
}

/* ===================== 1.7.7 · Líneas del carrito y código promocional ===================== */
@media (max-width: 767px) {
  /* Precio unidad · − n + · total · papelera, cada uno en su sitio */
  body#cart #wrapper .product-line-grid-right,
  body#cart #wrapper .product-line-grid-right .row,
  body#cart #wrapper .product-line-actions,
  body#cart #wrapper .product-line-actions .row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px;
    margin: 0 !important;
    width: 100% !important;
  }
  body#cart #wrapper .product-line-grid-right [class*="col-"],
  body#cart #wrapper .product-line-actions [class*="col-"] {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
    padding: 0 !important;
    float: none !important;
  }
  /* La columna vacía del tema no ocupa sitio */
  body#cart #wrapper .product-line-grid-right > .row > [class*="col-"]:empty,
  body#cart #wrapper .product-line-actions > .row > [class*="col-"]:empty { display: none !important; }
  /* El bloque central se estira y el total y la papelera quedan a la derecha */
  body#cart #wrapper .product-line-grid-right > .row > [class*="col-"]:not(:empty):not(:last-child),
  body#cart #wrapper .product-line-actions > .row > [class*="col-"]:not(:empty):not(:last-child) { flex: 1 1 auto !important; }
  body#cart #wrapper .product-line-grid-right .price,
  body#cart #wrapper .product-line-actions .price {
    margin-left: auto !important;
    text-align: right !important;
    white-space: nowrap;
  }
  body#cart #wrapper .product-line-grid-right .qty,
  body#cart #wrapper .product-line-actions .qty { flex: 0 0 auto !important; }
  body#cart #wrapper .product-line-grid-right .masi-qwrap,
  body#cart #wrapper .product-line-actions .masi-qwrap { margin: 0 !important; }
  body#cart #wrapper .cart-line-product-actions,
  body#cart #wrapper .remove-from-cart { flex: 0 0 auto !important; margin-left: 4px !important; }

  /* Código promocional: sin fondo interior ni icono, campo y botón separados */
  html body .block-promo .promo-code,
  html body .block-promo .promo-code > * { background: transparent !important; box-shadow: none !important; }
  html body .block-promo .promo-code { padding: 4px 0 !important; margin: 0 !important; }
  html body .block-promo .promo-code .material-icons,
  html body .block-promo .promo-code .fa-tag,
  html body .block-promo .promo-code i { display: none !important; }
  html body .block-promo .promo-code form,
  html body .block-promo .promo-code .input-group,
  html body .block-promo form {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
  }
  html body .block-promo .promo-input,
  html body .block-promo input[name="discount_name"] {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
  }
  html body .block-promo button,
  html body .block-promo .btn {
    flex: 0 0 auto !important;
    margin: 0 0 0 0 !important;
    padding: 0 18px !important;
  }
}

/* ===================== 1.8.2 · Código promocional al ancho del total ===================== */
@media (max-width: 767px) {
  html body .cart-summary .block-promo,
  html body .cart-summary .cart-voucher,
  html body #js-checkout-summary .block-promo {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 14px 16px !important;
    box-sizing: border-box;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }
  html body .cart-summary .block-promo .promo-code,
  html body .cart-summary .block-promo .cart-voucher,
  html body .cart-summary .block-promo .card-block,
  html body .cart-summary .block-promo > div,
  html body .cart-summary .block-promo form,
  html body #js-checkout-summary .block-promo .promo-code,
  html body #js-checkout-summary .block-promo > div {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
  }
  html body .cart-summary .block-promo *:not(input):not(button):not(.btn) {
    border-color: transparent !important;
    box-shadow: none !important;
  }
  html body .cart-summary .block-promo hr { display: none !important; }
  /* Línea del carrito mientras se actualiza */
  .cart-items .masi-qwrap.is-busy { opacity: .5; pointer-events: none; }
}

/* ===================== 1.8.4 · Tarjeta de código de descuento (cupón) ===================== */
@media (max-width: 767px) {
  #masi-promo-card {
    position: relative;
    margin: 0 0 14px !important;
    padding: 16px;
    border: 1.5px dashed rgba(217, 38, 63, .45);
    border-radius: 20px;
    background: linear-gradient(135deg, var(--masi-accent-soft) 0%, #fff 100%);
    font-family: var(--masi-font);
  }
  #masi-promo-card .masi-promo__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
  #masi-promo-card .masi-promo__icon {
    flex: 0 0 40px;
    height: 40px;
    border-radius: 20px;
    background: var(--masi-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #masi-promo-card .masi-promo__texts { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  #masi-promo-card .masi-promo__title { color: var(--masi-ink); font-size: var(--masi-fs-md); font-weight: 700; line-height: 1.3; }
  #masi-promo-card .masi-promo__text { color: var(--masi-muted); font-size: var(--masi-fs-sm); font-weight: 400; line-height: 1.4; }

  /* El formulario del tema, dentro de la tarjeta */
  #masi-promo-card .block-promo,
  #masi-promo-card .block-promo > *,
  #masi-promo-card .promo-code,
  #masi-promo-card .cart-voucher {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  #masi-promo-card .promo-code .material-icons,
  #masi-promo-card .promo-code .fa-tag,
  #masi-promo-card .promo-code > i,
  #masi-promo-card hr { display: none !important; }
  #masi-promo-card form,
  #masi-promo-card .input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 0 !important;
  }
  #masi-promo-card .promo-input,
  #masi-promo-card input[name="discount_name"] {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 18px !important;
    border: 0 !important;
    border-radius: 24px !important;
    background: #fff !important;
    box-shadow: 0 1px 0 rgba(22, 24, 29, .04), inset 0 0 0 1px var(--masi-line) !important;
    font-size: var(--masi-fs-md) !important;
    letter-spacing: .02em;
  }
  #masi-promo-card .promo-input:focus,
  #masi-promo-card input[name="discount_name"]:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--masi-ink) !important; }
  #masi-promo-card button,
  #masi-promo-card .btn {
    flex: 0 0 auto !important;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 20px !important;
    border: 0 !important;
    border-radius: 24px !important;
    background: var(--masi-accent) !important;
    color: #fff !important;
    font-size: var(--masi-fs-sm) !important;
    font-weight: 700 !important;
    text-transform: none !important;
  }
  /* Códigos aplicados y sugeridos */
  #masi-promo-card .promo-name,
  #masi-promo-card .promo-discounts,
  #masi-promo-card .cart-summary-line {
    margin: 10px 0 0 !important;
    font-size: var(--masi-fs-sm) !important;
  }
  #masi-promo-card .js-error,
  #masi-promo-card .alert { margin: 10px 0 0 !important; border-radius: 12px !important; font-size: var(--masi-fs-sm) !important; }
}

/* 1.8.5 · En el pago, la tarjeta del cupón con la misma separación que el resto */
@media (max-width: 767px) {
  body#checkout #masi-promo-card { margin: 0 0 10px !important; }
}
