/* ==========================================
   NEXUS STORE — Catalog Page Styles
   ========================================== */

/* ── Reset body for full-page layout ─────── */
.catalog-page {
  background: #0a0f1a;
  min-height: 100vh;
}

/* ══════════════════════════════════════════
   TOP NAV
   ══════════════════════════════════════════ */
.cat-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(10,15,26,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cat-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  gap: 1rem;
}
.cat-nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #9ca3af;
  transition: color 0.2s;
  white-space: nowrap;
}
.cat-nav-back:hover { color: #22C55E; }

.cat-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #F9FAFB;
}

.cat-nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cat-nav-wa {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #25d366;
  background: rgba(37,211,102,0.08);
  border: 1px solid rgba(37,211,102,0.2);
  border-radius: 9999px;
  padding: 7px 14px;
  transition: all 0.2s;
}
.cat-nav-wa:hover { background: rgba(37,211,102,0.15); }

.cat-cart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: #9ca3af;
  background: #111827;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.cat-cart-btn:hover { border-color: #22C55E; color: #22C55E; }
.cat-cart-badge {
  background: #22C55E;
  color: #111827;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9999px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

/* ══════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════ */
.cat-page-header {
  background: linear-gradient(180deg, #111827 0%, #0a0f1a 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 2rem 1.5rem 1.5rem;
}
.cat-page-header-inner {
  max-width: 1440px;
  margin: 0 auto;
}
.cat-page-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: #F9FAFB;
  margin-bottom: 0.4rem;
}
.cat-page-subtitle {
  font-size: 0.88rem;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ══════════════════════════════════════════
   MAIN LAYOUT
   ══════════════════════════════════════════ */
.cat-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ══════════════════════════════════════════
   FILTERS BAR
   ══════════════════════════════════════════ */
.cat-filters {
  background: #111827;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 60px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Row 1: search + toggle + count */
.cat-filter-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

/* Row 2: dropdowns (always visible on desktop) */
.cat-filter-dropdowns {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  width: 100%;
}

/* Toggle button — hidden on desktop */
.cat-filter-toggle {
  display: none;
}

.cat-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
  background: #1a2332;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9999px;
  padding: 9px 16px;
  transition: border-color 0.2s;
}
.cat-search-wrap:focus-within {
  border-color: #22C55E;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.15);
}
.cat-search-wrap svg { color: #6b7280; flex-shrink: 0; }
.cat-search-wrap input {
  font-family: 'Inter', sans-serif;
  font-size: 1rem; /* 16px min para evitar zoom en iOS */
  color: #F9FAFB;
  background: none;
  border: none;
  outline: none;
  width: 100%;
}
.cat-search-wrap input::placeholder { color: #6b7280; }

.cat-select {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #9ca3af;
  background: #1a2332;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9999px;
  padding: 9px 32px 9px 14px;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 150px;
}
.cat-select:focus { outline: none; border-color: #22C55E; color: #F9FAFB; }
.cat-select option { background: #111827; color: #F9FAFB; }

.cat-reset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 9999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.cat-reset-btn:hover { color: #22C55E; border-color: #22C55E; }

.cat-count {
  font-size: 0.78rem;
  color: #6b7280;
  white-space: nowrap;
  margin-left: auto;
}

/* Active filters dot indicator */
.cat-filter-active-dot {
  width: 7px;
  height: 7px;
  background: #22C55E;
  border-radius: 50%;
  display: none;
  flex-shrink: 0;
}
.cat-filter-active-dot.visible { display: block; }

/* ══════════════════════════════════════════
   PRODUCT GRID
   ══════════════════════════════════════════ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

/* ── Product card ────────────────────────── */
.catalog-card {
  background: #111827;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.catalog-card:hover {
  border-color: rgba(34,197,94,0.25);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

/* Image */
.cc-img {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #1a2332;
}
.cc-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.catalog-card:hover .cc-img img { transform: scale(1.05); }

.cc-badge-tipo {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  background: rgba(10,15,26,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  color: #9ca3af;
  padding: 3px 8px;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
}

/* Card body */
.cc-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

/* Name + ref row */
.cc-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.cc-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  color: #F9FAFB;
  line-height: 1.25;
}
.cc-ref {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(34,197,94,0.15);
  color: #22C55E;
  border: 1px solid rgba(34,197,94,0.25);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.cc-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.cc-marca {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #22C55E;
}
.cc-sep { color: rgba(255,255,255,0.2); font-size: 0.68rem; }
.cc-cat {
  font-size: 0.68rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cc-color {
  font-size: 0.72rem;
  color: #6b7280;
}

/* Size buttons */
.cc-sizes-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #6b7280;
  margin-top: 4px;
}
.cc-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.sz-btn {
  width: 30px;
  height: 26px;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: 'Inter', sans-serif;
}
/* available */
.sz-btn.sz-on {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.3);
  color: #22C55E;
}
.sz-btn.sz-on::after {
  content: '';
  position: absolute;
  top: 2px; right: 2px;
  width: 5px; height: 5px;
  background: #22C55E;
  border-radius: 50%;
}
.sz-btn.sz-on:hover {
  background: #22C55E;
  color: #111827;
  border-color: #22C55E;
}
.sz-btn.sz-on:hover::after { background: #111827; }
/* selected */
.sz-btn.sz-selected {
  background: #22C55E !important;
  color: #111827 !important;
  border-color: #22C55E !important;
  font-weight: 800;
}
.sz-btn.sz-selected::after { background: #111827 !important; }
/* out of stock — clickable for encargo */
.sz-btn.sz-off {
  background: transparent;
  border-color: rgba(255,255,255,0.15);
  color: #9ca3af;
  cursor: pointer;
}
.sz-btn.sz-off:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}
.sz-btn.sz-off.sz-selected {
  background: rgba(245,158,11,0.12) !important;
  border-color: #f59e0b !important;
  color: #f59e0b !important;
  font-weight: 800;
}
.sz-btn.sz-off.sz-selected::after { display: none; }

/* Action buttons */
.cc-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}
.cc-add-btn {
  flex: 1;
  padding: 9px 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  background: #22C55E;
  color: #111827;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.cc-add-btn:disabled {
  background: #1a2332;
  color: #6b7280;
  cursor: not-allowed;
}
.cc-add-btn:not(:disabled):hover { background: #4ade80; }
/* encargo variant */
.cc-add-btn.cc-add-encargo {
  background: rgba(245,158,11,0.15);
  color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.3);
}
.cc-add-btn.cc-add-encargo:hover { background: #f59e0b; color: #111827; }

.cc-wa-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 8px;
  border: none;
  background: rgba(37,211,102,0.12);
  color: #25d366;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.cc-wa-btn:hover { background: #25d366; color: white; }

/* ══════════════════════════════════════════
   LOADING / EMPTY
   ══════════════════════════════════════════ */
.catalog-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem 0;
  color: #6b7280;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
}
.catalog-spinner {
  display: block;
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.06);
  border-top-color: #22C55E;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.catalog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.9;
  font-family: 'Inter', sans-serif;
}

/* ══════════════════════════════════════════
   CART PANEL (reused from index.css base)
   ══════════════════════════════════════════ */
.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 1100;
}
.cart-panel {
  position: fixed;
  top: 0; right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: #111827;
  border-left: 1px solid rgba(255,255,255,0.06);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
.cart-panel.open { transform: translateX(0); }
.cart-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.cart-panel-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #F9FAFB;
}
.cart-count { font-size: 0.75rem; color: #6b7280; margin-top: 2px; }
.cart-close-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  background: none; border: none;
}
.cart-close-btn:hover { background: #1a2332; color: #F9FAFB; }
.cart-list {
  flex: 1; overflow-y: auto;
  padding: 1rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.cart-empty-msg {
  color: #6b7280; font-size: 0.85rem; line-height: 1.8;
  text-align: center; padding: 3rem 1rem;
  font-family: 'Inter', sans-serif;
}
.cart-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem;
  background: #1a2332;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
}
.ci-thumb {
  width: 56px; height: 56px;
  border-radius: 8px; object-fit: cover; flex-shrink: 0;
  background: #0a0f1a;
}
.ci-info { flex: 1; min-width: 0; }
.ci-brand { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #22C55E; }
.ci-name { font-size: 0.82rem; font-weight: 600; color: #F9FAFB; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-detail { font-size: 0.72rem; color: #6b7280; margin-top: 2px; }
.ci-del {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 0.7rem; color: #6b7280;
  flex-shrink: 0; cursor: pointer;
  background: none; border: none; transition: all 0.15s;
}
.ci-del:hover { background: rgba(239,68,68,0.1); color: #ef4444; }
.ci-stock-tag {
  display: inline-block;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  background: rgba(34,197,94,0.1); color: #22C55E;
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 4px; padding: 2px 6px; margin-top: 3px;
}
.ci-encargo-tag {
  display: inline-block;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  background: rgba(245,158,11,0.1); color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 4px; padding: 2px 6px; margin-top: 3px;
}
.cart-panel-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 0.75rem; flex-shrink: 0;
}
.cart-footer-note { font-size: 0.72rem; color: #6b7280; text-align: center; font-family: 'Inter', sans-serif; }
.cart-wa-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 13px;
  background: #25d366; color: white;
  font-family: 'Inter', sans-serif; font-size: 0.88rem; font-weight: 700;
  border-radius: 10px; cursor: pointer; border: none; transition: all 0.2s;
}
.cart-wa-btn:hover { background: #20b858; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,211,102,0.35); }

/* ══════════════════════════════════════════
   LANDING PAGE PREVIEW EXTRAS
   ══════════════════════════════════════════ */
.catalog-preview-footer {
  text-align: center;
  margin-top: 2.5rem;
}
.catalog-see-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1280px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 1024px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }

  /* Filters — no sticky, estructura colapsable */
  .cat-filters {
    position: static;
    padding: 0.75rem 1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin-bottom: 0.75rem;
    gap: 0;
  }

  /* Topbar: search flex-1, toggle fijo, count auto */
  .cat-filter-topbar {
    gap: 0.5rem;
  }

  .cat-search-wrap { min-width: unset; }

  /* Toggle visible en mobile */
  .cat-filter-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #9ca3af;
    background: #1a2332;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 9999px;
    padding: 10px 14px;
    cursor: pointer;
    flex-shrink: 0;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
  }
  .cat-filter-toggle[aria-expanded="true"] {
    border-color: #22C55E;
    color: #22C55E;
  }

  /* Dropdowns ocultos por defecto */
  .cat-filter-dropdowns {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
  }
  .cat-filter-dropdowns.open {
    display: flex;
  }

  .cat-select { min-width: unset; width: 100%; min-height: 44px; }
  .cat-reset-btn { width: 100%; justify-content: center; min-height: 44px; }
  .cat-count { margin-left: auto; font-size: 0.72rem; white-space: nowrap; }

  /* Nav */
  .cat-nav-wa { display: none; }
  .cat-nav-inner { padding: 0 1rem; }
  .cat-page-header { padding: 1.25rem 1rem 1rem; }
  .cat-main { padding: 0.75rem; }
  .cart-panel { width: 100vw; }
  .cat-cart-btn { padding: 7px 12px; gap: 6px; }
}

@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .cc-body { padding: 0.6rem; gap: 0.25rem; }
  .cc-name { font-size: 0.78rem; }
  .sz-btn { width: 32px; height: 32px; font-size: 0.62rem; border-radius: 6px; }
  .cc-actions { flex-direction: column; gap: 5px; }
  .cc-wa-btn { width: 100%; height: 38px; }
  .cat-nav-brand span { display: none; }
  .cat-nav-inner { height: 52px; }
  /* WhatsApp float safe area (iPhone home indicator) */
  .whatsapp-float {
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: calc(20px + env(safe-area-inset-right));
  }
}

@media (max-width: 360px) {
  .cat-grid { grid-template-columns: 1fr; }
  .cat-nav-back span { display: none; }
}
