/* ==========================================================
   BESPOKE INDUSTRIAL ECOMMERCE CSS
   Premium SaaS-Inspired UI for Xanausun
   ========================================================== */

/* ── LAYOUT FOUNDATIONS ──────────────────────────────────── */

.products-container {
  background: var(--bg-light);
  min-height: 100vh;
}

.products-container-wide {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 3rem;
}

@media (max-width: 768px) {
  .products-container-wide {
    padding: 0 1.5rem;
  }
}

.products-header {
  padding: calc(var(--nav-height) + 4rem) 0 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: var(--bg-dark);
}

.products-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.products-subtitle {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-muted-dark);
  max-width: 600px;
}

.products-layout {
  display: flex;
  margin-top: 3rem;
  padding-bottom: 6rem;
  gap: 3rem;
}

/* ── SIDEBAR & FILTERS ───────────────────────────────────── */

.products-sidebar {
  width: 280px;
  flex-shrink: 0;
}

.sidebar-sticky {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
  max-height: calc(100vh - var(--nav-height) - 4rem);
  overflow-y: auto;
  background: white;
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

/* Custom scrollbar for the sidebar */
.sidebar-sticky::-webkit-scrollbar {
  width: 6px;
}
.sidebar-sticky::-webkit-scrollbar-track {
  background: transparent;
  margin: 1rem 0;
}
.sidebar-sticky::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 10px;
}
.sidebar-sticky::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.25);
}

.sidebar-heading {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text-dark);
}

.filter-group {
  margin-bottom: 2.5rem;
}

.filter-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-dark);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.filter-label:hover {
  color: var(--accent);
}

/* Custom Checkbox */
.filter-label input {
  display: none;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0,0,0,0.15);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: var(--bg-surface-light);
}

.filter-label input:checked + .custom-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.filter-label input:checked + .custom-checkbox::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.btn-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-clear:hover {
  background: #fecaca;
}

/* ── RESULTS & GRID ──────────────────────────────────────── */

.products-main {
  flex: 1;
}

.products-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.results-count {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted-dark);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}

@media (max-width: 1200px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── PRODUCT CARD ────────────────────────────────────────── */

.product-card {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 20px;
  border: 1px solid rgba(0,0,0,0.05);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  position: relative;
}

.product-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.1);
}

.product-card:hover::after {
  opacity: 1;
}

.card-image-wrapper {
  position: relative;
  height: 260px;
  background: rgba(0,0,0,0.02);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.product-card:hover .card-image {
  transform: scale(1.05);
}

.card-hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9,9,11,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.card-hover-overlay span {
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 50px;
  background: rgba(255,255,255,0.1);
}

.product-card:hover .card-hover-overlay {
  opacity: 1;
}

.card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0.35rem 0.85rem;
  border-radius: 50px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dark);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text-dark);
}

.card-desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted-dark);
  margin-bottom: 1.5rem;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.metric-label {
  color: var(--text-muted-light);
  font-weight: 600;
}

.metric-value {
  color: var(--text-dark);
  font-weight: 700;
}

.card-footer {
  padding-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
}

.card-action {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.icon-arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.product-card:hover .icon-arrow {
  transform: translateX(4px);
}

/* ── EMPTY STATE ─────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem;
  background: white;
  border-radius: 20px;
  border: 1px dashed rgba(0,0,0,0.15);
}

.empty-icon-wrap {
  width: 80px;
  height: 80px;
  background: var(--bg-surface-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--text-muted-light);
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.empty-desc {
  font-size: 1rem;
  color: var(--text-muted-dark);
  max-width: 400px;
}

/* ── INDIVIDUAL PRODUCT PAGE (PDP) ───────────────────────── */

.s-pdp {
  padding-top: calc(var(--nav-height) + 2rem);
  background: var(--bg-light);
  min-height: 100vh;
}

.s-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted-dark);
  margin-bottom: 2.5rem;
}

.s-breadcrumb a {
  color: var(--text-muted-dark);
  text-decoration: none;
  transition: color 0.2s;
}

.s-breadcrumb a:hover {
  color: var(--accent);
}

.s-breadcrumb .slash {
  color: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
}

.s-breadcrumb .current {
  color: var(--text-dark);
}

.s-pdp-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 4rem;
  align-items: start;
  margin-bottom: 5rem;
}

/* GALLERY */
.s-gallery {
  position: sticky;
  top: calc(var(--nav-height) + 2rem);
}

.s-gallery-frame {
  background: white;
  border-radius: 24px;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.04), inset 0 0 0 1px rgba(0,0,0,0.04);
}

.s-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.s-gallery-frame:hover .s-main-img {
  transform: scale(1.1);
}

.s-zoom-hint {
  position: absolute;
  bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dark);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  pointer-events: none;
}

/* INFO STACK */
.s-info {
  display: flex;
  flex-direction: column;
}

.s-pills {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.s-pill {
  padding: 0.4rem 1.25rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.brand-pill {
  background: var(--text-dark);
  color: white;
}

.cat-pill {
  background: rgba(0,0,0,0.05);
  color: var(--text-muted-dark);
}

.s-title {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text-dark);
  margin-bottom: 1.25rem;
}

.s-desc {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--text-muted-dark);
  font-weight: 400;
}

.s-divider {
  height: 1px;
  background: rgba(0,0,0,0.08);
  margin: 2.5rem 0;
}

.s-specs-heading {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted-dark);
  margin-bottom: 1.5rem;
}

.s-specs-grid {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  overflow: hidden;
}

.s-spec-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.s-spec-item:last-child {
  border-bottom: none;
}

.s-spec-label {
  padding: 1.25rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted-light);
  background: rgba(0,0,0,0.015);
  border-right: 1px solid rgba(0,0,0,0.04);
}

.s-spec-value {
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.s-actions {
  display: block;
  margin-top: 2.5rem;
}

.s-btn-primary {
  width: 100%;
  justify-content: center;
  padding: 1.25rem 2rem;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
}

.s-btn-secondary {
  width: 100%;
  justify-content: center;
  padding: 1.25rem 2rem;
  font-size: 1rem;
  border-radius: 12px;
  background: white !important;
  color: var(--text-dark) !important;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.s-btn-secondary:hover {
  border-color: rgba(0,0,0,0.2);
  background: #f8fafc !important;
}

.s-trust {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 2.5rem;
  padding-top: 2.5rem;
  border-top: 1px dashed rgba(0,0,0,0.1);
}

.s-trust-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.s-trust-icon {
  font-size: 1.2rem;
  display: block;
  margin-top: 2px;
}

.s-trust-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.s-trust-item span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted-light);
}

/* CONTENT BAND */
.s-content-band {
  padding: 6rem 0;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.s-content-main {
  width: 100%;
  margin: 0 auto;
}

.s-prose {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-dark);
}

.s-prose p { margin-bottom: 1.5rem; }
.s-prose h2 { margin: 3rem 0 1rem; font-size: 1.75rem; font-weight: 800; }
.s-prose h2:first-child { margin-top: 0; }
.s-prose ul { margin-left: 1.5rem; margin-bottom: 2rem; list-style: circle; }
.s-prose li { margin-bottom: 0.75rem; }

/* ── MARKDOWN TABLE STYLES ───────────────────────────────── */
.s-prose table {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 3rem auto;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid #e4e4e7;
  overflow: hidden;
}

/* For mobile devices, switch to block to enable horizontal scrolling */
@media (max-width: 768px) {
  .s-prose table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

.s-prose th {
  background: #09090b;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 1.25rem 1.5rem;
  text-align: left;
  border-bottom: 2px solid rgba(255,255,255,0.1);
}

.s-prose td {
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #27272a;
  border-bottom: 1px solid #e4e4e7;
}

.s-prose tr:last-child td {
  border-bottom: none;
}

.s-prose tbody tr:nth-child(even) td {
  background: #fafafa;
}

.s-prose tbody tr:hover td {
  background: #f1f5f9;
}

/* ── RESPONSIVE OVERRIDES ────────────────────────────────── */

.mobile-filter-btn { display: none; }
.sidebar-overlay { display: none; }
.sidebar-close-btn { display: none; }

@media (max-width: 1024px) {
  .products-layout { flex-direction: column; }
  .products-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: white;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 20px 0 50px rgba(0,0,0,0.15);
  }
  
  .products-sidebar.is-open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-sticky {
    position: static;
    height: 100%;
    overflow-y: auto;
    padding: 2rem;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  
  .sidebar-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 2rem;
  }
  
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-dark);
  }

  .mobile-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    color: var(--text-dark);
  }
  
  .s-pdp-layout { grid-template-columns: 1fr; gap: 3rem; }
  .s-gallery { position: relative; top: 0; }
  .s-gallery-frame { height: 50vh; }
  
  .s-content-grid { grid-template-columns: 1fr; gap: 3rem; }
  .s-content-sidebar { position: static; }
}

@media (max-width: 640px) {
  .s-actions { grid-template-columns: 1fr; }
  .s-spec-item { grid-template-columns: 1fr; }
  .s-spec-label { padding: 1rem 1.25rem; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.03); }
}
