/* ── COSPOR Mayorista — paleta clara, branding tiendacospor.com.ar ──────── */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:        #f5f5f5;
  --surface:   #ffffff;
  --surface-2: #fafafa;
  --red:       #D33523;
  --red-d:     #B02C1E;
  --red-l:     #FBE5E2;
  /* Backcompat: aliases del CSS viejo. NO usar en nuevo código. */
  --orange:    #D33523;
  --orange-d:  #B02C1E;
  --orange-l:  #FBE5E2;
  --text:      #1a1a1a;
  --text-2:    #555555;
  --muted:     #8a8a8a;
  --border:    #e5e5e5;
  --border-2:  #d0d0d0;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.08), 0 8px 28px rgba(0,0,0,.08);

  --font-head: 'Barlow Condensed', 'Bahnschrift Condensed', Impact, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }

/* ── Layout / utilities ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.row { display: flex; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.center { align-items: center; }
.spacer { flex: 1; }

/* ── Tipografía branded ── */
.h-display {
  font-family: var(--font-head);
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text);
}
.h-section {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.orange-bar {
  display: inline-block;
  width: 48px;
  height: 4px;
  background: var(--orange);
  margin: 14px 0;
}

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: background .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-primary:hover { background: var(--red-d); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--text); }
.btn-sm { padding: 9px 16px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── Inputs ── */
.input, .select {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(211,53,35,.15);
}
.input:disabled, .select:disabled {
  background: #f5f5f5;
  color: var(--muted);
  cursor: not-allowed;
}
.input::placeholder { color: var(--muted); }
.label {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ════════════════════════════════════════════════════
   GATE PAGE (index.html)
   ════════════════════════════════════════════════════ */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(211,53,35,0.05), transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(211,53,35,0.04), transparent 50%),
    var(--bg);
}
.gate-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 40px 36px;
  text-align: center;
}
.gate-logo {
  display: block;
  margin: 0 auto 20px;
  width: 160px;
}
.gate-title {
  font-size: 28px;
  margin-bottom: 4px;
}
.gate-subtitle {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 24px;
}
.gate-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.gate-form .btn { margin-top: 8px; }
.gate-disclaimer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.gate-disclaimer a { color: var(--text-2); text-decoration: underline; }

.gate-error {
  background: #ffeaea;
  color: #b00020;
  border: 1px solid #f5c2c2;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════
   CATÁLOGO PAGE (catalogo.html)
   ════════════════════════════════════════════════════ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-logo { height: 32px; width: auto; }
.topbar-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
}
.topbar-update {
  font-size: 11px;
  color: var(--muted);
}
.topbar-actions { margin-left: auto; }

/* Filter bar */
.filters {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 0 16px;
  position: sticky;
  top: 60px;
  z-index: 90;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
}
.filters-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 1.6fr auto;
  gap: 12px;
  align-items: end;
}
.filters-grid .field { display: flex; flex-direction: column; }
.filter-clear {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 4px;
  padding: 12px 16px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.filter-clear:hover { background: var(--red); color: #fff; }

/* ── View toggle (cards / table) ── */
.view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  overflow: hidden;
}
.view-toggle button {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-2);
  border-right: 1px solid var(--border-2);
  transition: background .15s, color .15s;
}
.view-toggle button:last-child { border-right: 0; }
.view-toggle button:hover { color: var(--text); background: #fafafa; }
.view-toggle button.active {
  background: var(--red);
  color: #fff;
}
.view-toggle svg { width: 18px; height: 18px; }

/* Resultado count */
.results-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 24px 0 16px;
}
.results-count {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.results-count .num { color: var(--red); }
.results-meta { color: var(--muted); font-size: 13px; }

/* Grid de productos */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding-bottom: 60px;
}

.card {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s, transform .12s, border-color .18s;
}
.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--border-2);
}
.card-img {
  aspect-ratio: 1 / 1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.card-img img {
  max-width: 88%;
  max-height: 88%;
  object-fit: contain;
  transition: transform .25s;
}
.card:hover .card-img img { transform: scale(1.04); }

.card-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 3px;
}
.badge-universal { background: var(--red-l); color: var(--red-d); }
.badge-brand { background: #111; color: #fff; }

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card-sku {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}
.card-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  min-height: 38px;
}
.card-compat {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.card-compat-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.card-prices {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.card-price-label {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-price-mayorista {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 24px;
  color: var(--text);
  line-height: 1;
}
.card-price-sugerido {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.card-iva {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 9px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
  vertical-align: middle;
}
.list-price-iva {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 9px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 2px;
}
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.card-actions .btn {
  flex: 1;
  font-size: 11px;
  padding: 8px 10px;
  letter-spacing: .06em;
}
.card-actions .btn-disabled {
  opacity: .35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Botón "Agregar al pedido" en cards/rows ── */
.btn-add {
  background: #1a1a1a;
  color: #fff;
}
.btn-add:hover { background: #000; color: #fff; }
.btn-add.in-cart {
  background: #16a34a;
  color: #fff;
}
.btn-add.in-cart:hover { background: #128a3d; }

/* Stepper en card cuando ya está agregado */
.card-stepper, .list-stepper {
  display: inline-flex;
  align-items: center;
  background: #1a1a1a;
  color: #fff;
  border-radius: 4px;
  overflow: hidden;
  flex: 1;
}
.card-stepper button, .list-stepper button {
  width: 28px;
  height: 30px;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-stepper button:hover, .list-stepper button:hover { background: rgba(255,255,255,0.15); }
.card-stepper-qty, .list-stepper-qty {
  flex: 1;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
}

/* ── Cart button en topbar ── */
.cart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--red);
  color: #fff;
  border-radius: 4px;
  padding: 8px 14px;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: background .15s;
  position: relative;
}
.cart-btn:hover { background: var(--red-d); }
.cart-btn svg { width: 16px; height: 16px; }
.cart-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #fff;
  color: var(--red);
  padding: 0 6px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.cart-btn[data-empty="1"] .cart-badge { background: rgba(255,255,255,0.25); color: #fff; }
@media (max-width: 600px) {
  .cart-btn span:first-of-type { display: none; }
}

/* ── Cart Modal ── */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  align-items: stretch;
  justify-content: flex-end;
  animation: cartFadeIn .2s ease;
}
.cart-overlay[data-open="1"] { display: flex; }
@keyframes cartFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cartSlideIn { from { transform: translateX(40px); } to { transform: translateX(0); } }

.cart-modal {
  width: 480px;
  max-width: 100vw;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: cartSlideIn .25s ease;
}
.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: #111;
  color: #fff;
}
.cart-header h2 {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .06em;
}
.cart-close {
  width: 36px; height: 36px;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  border-radius: 4px;
}
.cart-close:hover { background: rgba(255,255,255,.12); }

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.cart-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.cart-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.cart-empty-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 6px;
}
.cart-empty-text { font-size: 13px; }
.cart-items { display: flex; flex-direction: column; gap: 10px; }

.cart-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.cart-item-img {
  width: 56px; height: 56px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.cart-item-img img { max-width: 88%; max-height: 88%; object-fit: contain; }
.cart-item-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cart-item-sku {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}
.cart-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cart-item-price {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.cart-item-price strong { color: var(--red); font-family: var(--font-head); font-weight: 800; }

.cart-item-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cart-stepper-mini {
  display: inline-flex;
  align-items: center;
  background: #1a1a1a;
  color: #fff;
  border-radius: 4px;
  overflow: hidden;
}
.cart-stepper-mini button {
  width: 26px; height: 28px;
  background: transparent;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.cart-stepper-mini button:hover { background: rgba(255,255,255,.18); }
.cart-stepper-mini .qty {
  min-width: 28px;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
}
.cart-item-remove {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
}
.cart-item-remove:hover { color: #b00020; }

.cart-footer {
  border-top: 1px solid var(--border);
  padding: 18px 22px;
  background: var(--surface-2);
}
.cart-totals { margin-bottom: 14px; }
.cart-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-2);
}
.cart-totals-row strong { color: var(--text); }
.cart-totals-row--big {
  font-family: var(--font-head);
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 10px;
  color: var(--text);
}
.cart-totals-row--big strong { color: var(--red); font-size: 24px; font-weight: 800; }
.cart-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.cart-actions .btn-primary { flex: 1; background: #25D366; }
.cart-actions .btn-primary:hover { background: #1FB855; }
.cart-disclaimer {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.cart-empty[data-hidden="1"] { display: none; }
.cart-footer[data-hidden="1"] { display: none; }

/* ── Vista LISTA (tabla compacta) ── */
.list-wrap { padding-bottom: 60px; }
.list-table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.list-table thead th {
  background: #fafafa;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 12px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border-2);
}
.list-table tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.list-table tbody tr:hover td { background: #fafafa; }
.list-table tbody tr:last-child td { border-bottom: 0; }
.list-img {
  width: 56px; height: 56px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.list-img img { max-width: 90%; max-height: 90%; object-fit: contain; }
.list-sku {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
}
.list-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
}
.list-compat { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.list-price-mayorista {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  color: var(--red);
  white-space: nowrap;
}
.list-price-sugerido { font-size: 11px; color: var(--text-2); }
.list-actions { display: flex; gap: 4px; }
.list-actions a { font-size: 10px; padding: 5px 8px; }
.col-img { width: 76px; }
.col-sku { width: 110px; }
.col-price { width: 110px; text-align: right; }
.col-actions { width: 130px; }

/* Tabla responsive: en mobile, las celdas se apilan */
@media (max-width: 700px) {
  .list-table thead { display: none; }
  .list-table tbody tr {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 4px 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
  }
  .list-table tbody td {
    padding: 0;
    border: 0;
    font-size: 12px;
  }
  .list-table tbody td.col-img { grid-row: 1 / span 3; }
  .list-table tbody td.col-sku { grid-column: 2; }
  .list-table tbody td.col-name { grid-column: 2; }
  .list-table tbody td.col-price { grid-column: 2; text-align: left; }
  .list-table tbody td.col-actions { grid-column: 1 / -1; margin-top: 6px; }
}

/* Empty state */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}
.empty-title { font-size: 18px; color: var(--text-2); margin-bottom: 8px; font-family: var(--font-head); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.empty-text { font-size: 14px; }

/* Footer */
.footer {
  background: #111;
  color: #ddd;
  padding: 32px 0 28px;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
}
.footer h4 {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 12px;
}
.footer p, .footer a {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  line-height: 1.6;
}
.footer a:hover { color: var(--red); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 16px;
  font-size: 12px;
  color: rgba(255,255,255,.5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #fff !important;
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 700;
  margin-top: 8px;
}
.footer-wa:hover { background: #1FB855; color: #fff !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .filters-grid .field-search { grid-column: 1 / -1; }
  .filters-grid .filter-clear { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
  .topbar-title { display: none; }
  .topbar-update { font-size: 10px; }
  .gate-card { padding: 28px 22px; }
  .gate-title { font-size: 22px; }
  .card-price-mayorista { font-size: 20px; }
  .card-title { font-size: 13px; min-height: 34px; }
}
