/* ═══════════════════════════════════════════════════════════════
   WSHOP.CSS — Webshop Template Stylesheet
   Gedeelde styling voor alle webshop pagina's
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS VARIABELEN (overschreven door config.json via console) ── */
:root {
  /* Kleuren */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --error: #dc2626;
  --background: #ffffff;
  --panel: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  
  /* Typografie */
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-size-base: 16px;
  --heading-bold: 600;
  
  /* Layout */
  --radius: 8px;
  --spacing-factor: 1;
  --shadow-enabled: 1;
}

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── BODY ── */
body {
  font-family: var(--font-base);
  font-size: var(--font-size-base);
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.5rem;
  font-weight: var(--heading-bold);
  cursor: pointer;
}

.cart-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  transition: background 0.2s;
}

.cart-btn:hover {
  background: var(--primary-hover);
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  display: none;
}

.cart-count.visible {
  display: flex;
}

/* ── MAIN CONTAINER ── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

/* ── BUTTONS ── */
.btn {
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: white;
  border-color: var(--primary);
}

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

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 2rem;
  transition: background 0.2s;
}

.back-btn:hover {
  background: white;
}

/* ── FILTER SECTION ── */
.filters {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(1.5rem * var(--spacing-factor));
  margin-bottom: calc(2rem * var(--spacing-factor));
}

.filter-section {
  margin-bottom: 1.5rem;
}

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

.filter-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  background: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-select:hover {
  border-color: var(--primary);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-reset {
  background: var(--muted);
  color: white;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: calc(var(--radius) / 2);
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 1rem;
  transition: background 0.2s;
}

.filter-reset:hover {
  background: var(--text);
}

/* ── PRODUCT GRID ── */
.product-count {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: calc(0px + (0 * (1 - var(--shadow-enabled)))) calc(8px * var(--shadow-enabled)) calc(16px * var(--shadow-enabled)) rgba(0,0,0,calc(0.1 * var(--shadow-enabled)));
}

.product-card.hidden {
  display: none;
}

.product-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  background: var(--panel);
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.product-info {
  padding: 1rem;
}

.product-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.product-tag {
  background: var(--panel);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.product-stock {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.product-stock.unavailable {
  color: var(--error);
  font-weight: 500;
}

.add-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem;
  border-radius: calc(var(--radius) / 2);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.add-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.add-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* ── PRODUCT DETAIL ── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(3rem * var(--spacing-factor));
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(2rem * var(--spacing-factor));
}

.product-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 2rem;
}

.product-image {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
}

.product-details {
  display: flex;
  flex-direction: column;
}

.product-title {
  font-size: 1.75rem;
  font-weight: var(--heading-bold);
  margin-bottom: calc(1rem * var(--spacing-factor));
  line-height: 1.3;
}

.product-detail .product-price {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.product-detail .product-stock {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: var(--panel);
  border-radius: calc(var(--radius) / 2);
  text-align: center;
}

.product-stock.available {
  background: #f0fdf4;
  color: var(--success);
  font-weight: 500;
}

.product-description {
  margin-bottom: 2rem;
  line-height: 1.8;
  color: var(--text);
}

.product-attributes {
  margin-bottom: 2rem;
}

.attribute-row {
  display: flex;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.attribute-row:last-child {
  border-bottom: none;
}

.attribute-label {
  font-weight: 600;
  color: var(--muted);
  min-width: 120px;
}

.attribute-value {
  color: var(--text);
}

.add-to-cart-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quantity-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quantity-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  border-radius: calc(var(--radius) / 2);
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.quantity-btn:hover:not(:disabled) {
  background: white;
  border-color: var(--primary);
  color: var(--primary);
}

.quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-value {
  font-size: 1.25rem;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}

/* ── LOADING & ERROR ── */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  padding: calc(1rem * var(--spacing-factor));
  border-radius: var(--radius);
  margin-bottom: calc(2rem * var(--spacing-factor));
}

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  
  main {
    padding: 1rem;
  }
  
  .products {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
  
  .product-detail {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.5rem;
  }
  
  .product-title {
    font-size: 1.5rem;
  }
  
  .product-detail .product-price {
    font-size: 1.5rem;
  }
}
