/* SuperPatch Reseller Portal — Storefront styling
   Premium SuperPatch-inspired aesthetic: deep navy background, elevated
   product cards, cyan-teal accent, uppercase brand-forward product names. */

:root {
  --bg: #0a0e27;
  --bg-gradient-end: #0d1230;
  --card-bg: #141833;
  --card-bg-elevated: #1a2044;
  --text: #f0f0f0;
  --text-muted: #9aa0c0;
  --accent: #00d4ff;
  --accent-dark: #0a0e27;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.site-header {
  padding: 24px;
  text-align: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-gradient-end) 60%, #0f1740 100%);
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
  position: relative;
}

.site-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}

.cart-icon {
  position: absolute;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-glyph {
  font-size: 1.25rem;
}

.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-dark);
  font-size: 0.7rem;
  font-weight: 700;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 24px;
}

@media (min-width: 768px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.product-card {
  background: linear-gradient(160deg, var(--card-bg-elevated) 0%, var(--card-bg) 100%);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.15);
}

.product-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 12px;
}

.product-category {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.product-name {
  margin: 4px 0;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.product-description {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 300;
  line-height: 1.4;
}

.tier-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tier-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tier-btn:hover,
.tier-btn.selected-tier {
  background: var(--accent);
  color: var(--accent-dark);
  transform: scale(1.03);
}

.tier-btn.selected-tier {
  border-color: var(--accent);
  font-weight: 700;
}

.tier-label {
  font-weight: 600;
}

.price-display {
  margin-top: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
}

.cart-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}

/* Cart drawer + overlay (CART-01, CART-02) */

.cart-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.cart-overlay.cart-overlay-visible {
  display: block;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-left: 1px solid rgba(0, 212, 255, 0.2);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

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

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.cart-drawer-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.cart-items-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

.cart-item {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cart-item-image {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--card-bg-elevated);
}

.cart-item-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.cart-item-tier {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 2px 0 6px;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-qty {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}

.cart-item-qty-value {
  min-width: 16px;
  text-align: center;
}

.cart-item-line-total {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-cart-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.cart-total {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 12px 0;
  border-top: 1px solid rgba(0, 212, 255, 0.15);
}

.cart-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-dark);
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--text-muted);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(0, 212, 255, 0.1);
}

/* Checkout form + payment instructions (CART-03, CART-04) */

.checkout-section {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.checkout-section.checkout-section-open {
  display: flex;
}

.checkout-panel {
  background: var(--card-bg);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.checkout-panel h2 {
  margin-top: 0;
}

.order-summary {
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.order-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.order-summary-total {
  color: var(--text);
  font-weight: 700;
  border-top: 1px solid rgba(0, 212, 255, 0.15);
  margin-top: 6px;
  padding-top: 8px;
}

#checkout-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#checkout-form label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
}

#checkout-form input {
  background: var(--card-bg-elevated);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  font: inherit;
}

.checkout-error {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin: 8px 0 0;
}

.payment-amount-due {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

.payment-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.payment-option {
  background: var(--card-bg-elevated);
  border-radius: 8px;
  padding: 12px;
}

.payment-option-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.payment-option-handle {
  font-weight: 700;
  font-size: 1rem;
  margin-top: 4px;
}

.payment-note {
  color: var(--text-muted);
  font-size: 0.85rem;
}
