/* ============================================================
   SplitX | Store — additional styles
   Extends the base design system for store, product detail,
   cart sidebar, and checkout modal.
   ============================================================ */

/* ---------- store hero (compact) ---------- */

.hero-store { padding: 140px 0 40px; text-align: center; }
.hero-store .wordmark { font-size: clamp(2.8rem, 8vw, 5.5rem); }

/* ---------- filter bar ---------- */

.store-filters {
  position: sticky;
  top: 62px;
  z-index: 90;
  padding: 16px 0;
  background: rgba(4, 3, 11, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.filters-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 16px;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.25s ease;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.filter-pill:hover {
  background: var(--panel-hover);
  color: var(--text);
  border-color: var(--line-bright);
}

.filter-pill.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--violet-bright);
  border-color: var(--violet);
}

/* search box */

.search-box {
  position: relative;
  width: 260px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.search-box input::placeholder { color: var(--muted-2); }

.search-box input:focus {
  border-color: var(--line-bright);
  background: var(--panel-hover);
}

/* sort dropdown */

.sort-select {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 32px 8px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.25s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a79dc9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.sort-select:focus { border-color: var(--line-bright); }
.sort-select option { background: var(--bg-2); color: var(--text); }

/* ---------- product cards ---------- */

.product-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.product-card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
  mix-blend-mode: screen;
  transition: transform 0.4s ease;
}

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

.product-card-category {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  background: rgba(4, 3, 11, 0.75);
  backdrop-filter: blur(6px);
  color: var(--violet-bright);
  border: 1px solid var(--line);
}

.product-card-sale {
  position: absolute;
  top: 12px;
  right: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 12px;
  background: var(--grad-brand);
  color: #fff;
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%);
}

.product-card-body {
  flex: 1;
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--electric);
  letter-spacing: 0.02em;
}

.product-card-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.product-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.pill-sm {
  font-size: 10px !important;
  padding: 2px 8px !important;
}

.product-card-footer {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

.product-card-price {
  display: flex;
  align-items: baseline;
  align-self: flex-start;
  gap: 8px;
}

.product-card-price .price-was {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted-2);
  text-decoration: line-through;
}

.product-card-price .price-now {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.product-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 8px;
}

.product-card-actions .btn {
  width: 100%;
  padding-left: 0;
  padding-right: 0;
  font-size: 0.75rem;
}

/* ---------- cart toggle in nav ---------- */

.cart-toggle {
  position: relative;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.25s ease;
  display: flex;
  align-items: center;
}

.cart-toggle:hover { color: var(--text); }

.cart-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  background: var(--violet-deep);
  color: #fff;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.cart-badge.has-items {
  opacity: 1;
  transform: scale(1);
}

/* ---------- cart sidebar ---------- */

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 210;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.open { transform: translateX(0); }

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.cart-header h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--electric);
}

.cart-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

.cart-close:hover { color: var(--text); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

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

.cart-item-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
  mix-blend-mode: screen;
  background: var(--bg);
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--violet-bright);
  margin-top: 2px;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
}

.qty-btn {
  width: 28px;
  height: 28px;
  background: var(--panel);
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.qty-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.qty-value {
  font-family: var(--font-mono);
  font-size: 13px;
  width: 28px;
  text-align: center;
  color: var(--text);
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--muted-2);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

.cart-item-remove:hover { color: var(--pink); }

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
}

.cart-empty p:first-child {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--line);
  background: rgba(4, 3, 11, 0.5);
}

.cart-totals { margin-bottom: 16px; }

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}

.cart-total-row.cart-savings span:last-child { color: var(--teal); }

.cart-total-row.cart-total {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.cart-total-row.cart-total span:last-child {
  font-family: var(--font-display);
  font-size: 1.1rem;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cart-checkout-btn { width: 100%; }

.cart-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  text-align: center;
  margin-top: 10px;
}

/* ---------- checkout modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-panel {
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 26px 100%, 0 calc(100% - 26px));
  position: relative;
}

/* scanline texture on modal */
.modal-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--electric);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 28px; }

.checkout-section {
  margin-bottom: 28px;
}

.checkout-section:last-child { margin-bottom: 0; }

.checkout-section h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--violet-bright);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}

.checkout-item-name { color: var(--text); }

.checkout-item-detail {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.checkout-total span:last-child {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.checkout-auth-placeholder,
.checkout-payment-placeholder {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--panel);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
}

.checkout-auth-placeholder svg,
.checkout-payment-placeholder svg { flex-shrink: 0; }

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--line);
}

.modal-footer .btn { width: 100%; }

/* ---------- product detail page ---------- */

.hero-product-detail { padding: 140px 0 40px; }

.product-detail-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.product-detail-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}

.product-detail-image img {
  max-height: 320px;
  width: auto;
  mix-blend-mode: screen;
}

.product-detail-info { display: flex; flex-direction: column; gap: 12px; }

.product-detail-name {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.15;
}

.product-detail-version {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted-2);
}

.product-detail-desc {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.65;
}

.product-detail-price {
  margin-top: 8px;
}

.product-detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* ---------- product tabs ---------- */

.product-tabs {
  border: 1px solid var(--line);
  background: var(--panel);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  position: relative;
}

/* scanline on tabs */
.product-tabs::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
  pointer-events: none;
  z-index: 1;
}

.tab-nav {
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 24px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--violet-bright);
  border-bottom-color: var(--violet);
}

.tab-panel {
  display: none;
  padding: 28px;
}

.tab-panel.active { display: block; }

/* feature list in overview tab */

.feature-list { list-style: none; padding: 0; }

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.feature-list li:last-child { border-bottom: none; }

.feature-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--teal);
  margin-top: 2px;
}

/* changelog entries */

.changelog-entry { margin-bottom: 28px; }
.changelog-entry:last-child { margin-bottom: 0; }

.changelog-version {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--electric);
  margin-bottom: 4px;
}

.changelog-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 12px;
}

.changelog-changes {
  list-style: none;
  padding: 0;
}

.changelog-changes li {
  position: relative;
  padding: 4px 0 4px 20px;
  font-size: 14px;
  color: var(--muted);
}

.changelog-changes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  background: var(--violet);
  transform: rotate(45deg);
}

/* ---------- empty state ---------- */

.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-state svg {
  margin: 0 auto 20px;
  color: var(--muted-2);
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--muted-2);
}

/* ---------- "added to cart" feedback ---------- */

.add-to-cart-btn.added,
.add-to-cart-detail.added {
  pointer-events: none;
  background: rgba(45, 212, 191, 0.15) !important;
  border-color: var(--teal) !important;
  color: var(--teal) !important;
  -webkit-text-fill-color: var(--teal) !important;
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .product-detail-hero {
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
  }
}

@media (max-width: 860px) {
  .store-filters { top: 56px; }

  .filters-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-pills { order: 1; }
  .search-box { width: 100%; order: 0; }
  .sort-select { width: 100%; order: 2; }

  .product-detail-hero {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center;
  }

  .product-detail-image { padding: 30px; }

  .product-detail-info { align-items: center; }

  .product-detail-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .pill-row { justify-content: center; }

  .cart-sidebar { width: 100vw; }

  /* cart toggle positioning in mobile nav */
  .cart-toggle {
    order: -1;
    margin-right: auto;
  }
}

@media (max-width: 640px) {
  .hero-store { padding: 120px 0 30px; }

  .hero-product-detail { padding: 120px 0 30px; }

  .tab-btn { padding: 12px 16px; font-size: 11px; }

  .modal-panel {
    max-width: 100%;
    max-height: 100vh;
    clip-path: none;
  }
}
