/* ==========================================================================
   OffSale — Cards + Shop v2 · Sprint 3 · sesión 003
   Adaptado al mockup catalog: cards con favoritos, badge garantía verde,
   subtítulo cursiva naranja, brand+series arriba, GPU chip especial.
   ========================================================================== */

/* Assume tokens de offsale-header.css */
.osc-card,
.osc-card *,
.os-shop,
.os-shop * {
  box-sizing: border-box;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   SHOP LAYOUT
   ========================================================================== */
.os-shop {
  background: #f6f7f9;
  min-height: 60vh;
  padding: 32px 0 60px;
}
.os-shop .oss-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
}

/* --- SIDEBAR --- */
.os-shop .oss-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}
.os-shop .oss-filters {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.os-shop .oss-filters-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 4px;
}
.os-shop .oss-filters-title {
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #1a2740;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.os-shop .oss-clear {
  font-size: 11px;
  color: #f5630a;
  text-decoration: underline;
  font-weight: 600;
}

.os-shop .oss-filter-group {
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}
.os-shop .oss-filter-group:last-of-type {
  border-bottom: none;
}
.os-shop .oss-filter-label,
.os-shop .oss-collapse {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 6px 0;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #1a2740;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  text-align: left;
}
.os-shop .oss-collapse svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  color: #64748b;
}
.os-shop .oss-collapse.collapsed svg {
  transform: rotate(-90deg);
}
.os-shop .oss-checkbox-list,
.os-shop .oss-price-row {
  padding-top: 2px;
  padding-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 200px;
  overflow-y: auto;
}
.os-shop .oss-checkbox-list.collapsed,
.os-shop .oss-price-row.collapsed {
  display: none;
}
.os-shop .oss-price-row {
  flex-direction: row;
  gap: 6px;
  overflow: visible;
}
.os-shop .oss-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
  line-height: 1.3;
}
.os-shop .oss-check:hover {
  background: #f8fafc;
}
.os-shop .oss-check input {
  accent-color: #f5630a;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.os-shop .oss-check span {
  flex: 1;
}
.os-shop .oss-check em {
  color: #94a3b8;
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
}
/* Scrollbar sutil para listas largas */
.os-shop .oss-checkbox-list::-webkit-scrollbar {
  width: 4px;
}
.os-shop .oss-checkbox-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}
.os-shop .oss-input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #0f172a;
  width: 100%;
}
.os-shop .oss-input:focus {
  outline: none;
  border-color: #f5630a;
  box-shadow: 0 0 0 3px rgba(245, 99, 10, 0.15);
}
.os-shop .oss-input-sm {
  flex: 1;
  min-width: 0;
}
.os-shop .oss-btn-apply {
  background: #f5630a;
  color: #fff;
  border: none;
  padding: 11px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s ease;
}
.os-shop .oss-btn-apply:hover {
  background: #d95405;
}

/* --- MAIN --- */
.os-shop .oss-main {
  min-width: 0;
}
.os-shop .oss-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.os-shop .oss-title {
  font-family: "Inter", sans-serif;
  font-size: 34px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.5px;
}
.os-shop .oss-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.os-shop .oss-order-label {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}
.os-shop .oss-order-select {
  padding: 9px 32px 9px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>")
    right 12px center no-repeat;
  font-size: 13px;
  font-weight: 600;
  color: #1a2740;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  min-width: 190px;
}
.os-shop .oss-order-select:focus {
  outline: none;
  border-color: #f5630a;
}

/* Filtros activos (chips) */
.os-shop .oss-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.os-shop .oss-chip-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff4ec;
  border: 1px solid rgba(245, 99, 10, 0.25);
  color: #d95405;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.os-shop .oss-chip-active:hover {
  background: #fed7aa;
  border-color: #f5630a;
}
.os-shop .oss-chip-active svg {
  width: 12px;
  height: 12px;
}
.os-shop .oss-clear-all {
  font-size: 12.5px;
  color: #64748b;
  text-decoration: underline;
  padding: 6px 4px;
  align-self: center;
}

/* Grid de cards */
.os-shop .products {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.os-shop .products li.product {
  list-style: none;
  padding: 0;
  margin: 0;
  float: none;
  width: 100%;
}
.os-shop .products li.product::before {
  display: none;
}

/* Paginación */
.os-shop .oss-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.os-shop .oss-pagination a,
.os-shop .oss-pagination span {
  padding: 9px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.os-shop .oss-pagination .current {
  background: #f5630a;
  color: #fff;
  border-color: #f5630a;
}
.os-shop .oss-pagination a:hover {
  border-color: #f5630a;
  color: #f5630a;
}

.os-shop .oss-empty {
  background: #fff;
  border-radius: 12px;
  padding: 60px 24px;
  text-align: center;
  border: 1px solid #e2e8f0;
}
.os-shop .oss-empty h2 {
  color: #1a2740;
  font-family: "Inter", sans-serif;
  font-size: 22px;
  margin: 0 0 8px;
}
.os-shop .oss-empty p {
  color: #64748b;
  font-size: 14px;
  margin: 0 0 20px;
}

/* ==========================================================================
   CARDS (osc-*)
   ========================================================================== */
.osc-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
  position: relative;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
.osc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  border-color: #cbd5e1;
}

.osc-media {
  position: relative;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  overflow: hidden;
}
.osc-media-link {
  display: block;
  width: 100%;
  height: 100%;
}
.osc-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 20px;
  transition: transform 0.4s ease;
}
.osc-card:hover .osc-media img {
  transform: scale(1.05);
}

/* Badge layer */
.osc-badge-layer {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 2;
  gap: 6px;
}
.osc-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #fff;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  line-height: 1.4;
}
.osc-badge-grado--excelente {
  background: #16a34a;
}
.osc-badge-grado--muy-bueno {
  background: #2563eb;
}
.osc-badge-grado--bueno {
  background: #f59e0b;
  color: #422006;
}
.osc-badge-grado--outlet {
  background: #64748b;
}

/* Garantía: verde con icono hoja (patrón mockup) */
.osc-badge-garantia {
  background: #fff;
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.osc-badge-garantia svg {
  width: 12px;
  height: 12px;
  color: #16a34a;
}

/* Favoritos ♡ */
.osc-fav {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  /* padding:0 + border-box: el <button> del theme metía padding lateral y lo estiraba a óvalo */
  padding: 0;
  box-sizing: border-box;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  color: #64748b;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 3;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.osc-fav:hover {
  color: #f5630a;
  border-color: #f5630a;
  transform: scale(1.08);
}
.osc-fav.is-active {
  color: #ef4444;
  border-color: #ef4444;
}
.osc-fav.is-active svg {
  fill: #ef4444;
}
.osc-fav svg {
  width: 17px;
  height: 17px;
}

/* Body */
.osc-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.osc-brand {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  font-weight: 800;
}
.osc-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.2px;
}
.osc-title a {
  color: inherit;
  text-decoration: none;
}
.osc-title a:hover {
  color: #f5630a;
}

/* Subtítulo cursiva naranja (14" · Ideal trabajo profesional) */
.osc-subtitle {
  font-size: 12.5px;
  color: #d95405;
  font-weight: 600;
  font-style: italic;
  line-height: 1.3;
  margin: -4px 0 4px;
  /* Safety: si por alguna razón el texto es largo, cortar en 1 línea */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chips specs */
.osc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.osc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1.3;
}
/* GPU dedicada — chip especial con acento naranja */
.osc-chip--gpu {
  background: rgba(245, 99, 10, 0.1);
  color: #d95405;
  border: 1px solid rgba(245, 99, 10, 0.25);
  font-weight: 700;
}
.osc-chip--gpu::before {
  content: "▲";
  font-size: 9px;
  margin-right: 2px;
}

/* Precio */
.osc-price {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* [precio-claro] cajas por forma de pago (estilo CompraGamer/Venex) */
.osc-pay {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.osc-pay-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 3px;
}
.osc-pay--cash {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.osc-pay--cash .osc-pay-lbl {
  color: #15803d;
}
.osc-pay-val {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.osc-pay-off {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: #16a34a;
  padding: 1px 7px;
  border-radius: 6px;
  letter-spacing: 0;
}
.osc-pay--inst .osc-pay-lbl {
  color: #c2410c;
}
.osc-pay-val2 {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.osc-pay-val2 small {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}
.osc-price-was {
  align-self: flex-start;
  font-size: 11.5px;
  color: #94a3b8;
  text-decoration: line-through;
}
/* compat: clases viejas de precio (por si se referencian en related/otros) */
.osc-price-main {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
  line-height: 1;
}
.osc-price-old {
  display: inline-block;
  color: #64748b;
  text-decoration: line-through;
  font-size: 13px;
  margin-right: 6px;
}
.osc-price-inst {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}
.osc-price-inst strong {
  color: #f5630a;
  font-weight: 700;
}

/* CTAs */
.osc-cta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 8px;
}
.osc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  font-family: inherit;
}
.osc-btn--primary {
  background: #f5630a;
  color: #fff;
}
.osc-btn--primary:hover {
  background: #d95405;
  color: #fff;
}
.osc-btn--wa {
  background: #25d366;
  color: #fff;
  padding: 10px 12px;
}
.osc-btn--wa:hover {
  background: #128c7e;
}
.osc-btn--wa svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Sin stock */
.osc-card.outofstock .osc-media::after {
  content: "Sin stock";
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: grid;
  place-items: center;
  z-index: 3;
}
.osc-card.outofstock .osc-btn--primary {
  background: #94a3b8;
  pointer-events: none;
  opacity: 0.6;
}

/* Ocultar cosas del theme padre / plugins */
.woocommerce ul.products li.product .button.wc-forward,
.woocommerce ul.products li.product .added_to_cart,
.woocommerce ul.products li.product .nasa-hot-label,
.woocommerce ul.products li.product .nasa-onsale,
.woocommerce ul.products li.product .nasa-quickview,
.woocommerce ul.products li.product .nasa-hover-thumb,
.woocommerce ul.products li.product .yith-wcwl-add-to-wishlist,
.woocommerce ul.products li.product .wpb_wrapper,
.woocommerce ul.products li.product .nasa-icon-wrap,
.woocommerce ul.products li.product .nasa-product-details {
  display: none !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .os-shop .oss-container {
    grid-template-columns: 220px 1fr;
    gap: 20px;
  }
  .os-shop .products {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Botón Filtrar + drawer close: ocultos en desktop */
.os-shop .oss-filter-fab,
.os-shop .oss-drawer-close {
  display: none;
}

@media (max-width: 900px) {
  .os-shop .oss-container {
    grid-template-columns: 1fr;
  }
  /* ------- Filtros mobile: botón "Filtrar" + bottom-sheet -------
     Los filtros NO invaden el listado: quedan ocultos y se abren como
     drawer a pantalla (patrón MercadoLibre/Amazon/Back Market). */
  .os-shop .oss-filter-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    margin-bottom: 4px;
    border-radius: 12px;
    border: 1.5px solid #0f172a;
    background: #fff;
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
  }
  .os-shop .oss-filter-fab svg {
    width: 18px;
    height: 18px;
  }
  .os-shop .oss-fab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #f5630a;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
  }
  /* Sidebar oculto por defecto; con body.oss-drawer-open es el backdrop */
  .os-shop .oss-sidebar {
    display: none;
    position: relative;
    top: 0;
  }
  body.oss-drawer-open .os-shop .oss-sidebar {
    display: block;
    position: fixed;
    inset: 0;
    /* align-self:start del desktop encoge la caja fixed a contenido (h=0) */
    height: 100vh;
    align-self: auto;
    margin: 0;
    z-index: 999998;
    background: rgba(8, 12, 24, 0.55);
  }
  /* La hoja: ocupa desde 8vh hasta abajo, scrolleable */
  body.oss-drawer-open .os-shop .oss-filters {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 8vh;
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 16px 90px;
    animation: ossSheetUp 0.25s ease-out;
  }
  @keyframes ossSheetUp {
    from {
      transform: translateY(40px);
      opacity: 0.6;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  body.oss-drawer-open .os-shop .oss-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #0f172a;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  /* Botón aplicar fijo al pie de la hoja */
  body.oss-drawer-open .os-shop .oss-btn-apply {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 14px;
    z-index: 2;
    padding: 14px;
    font-size: 16px;
    border-radius: 12px;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.18);
  }
  .os-shop .oss-title {
    font-size: 26px;
  }
  .os-shop .oss-topbar {
    align-items: stretch;
  }
  .os-shop .oss-order-select {
    min-width: 100%;
  }
}
@media (max-width: 600px) {
  .os-shop .products {
    grid-template-columns: 1fr;
  }
}
