/* Shop page */
.shop-page { padding-top: 100px; padding-bottom: 60px; min-height: 100vh; }

.shop-header { margin-bottom: 32px; }
.shop-title { font-family: 'Bebas Neue', sans-serif; font-size: 2.8rem; letter-spacing: 0.04em; margin-bottom: 8px; }
.shop-subtitle { color: var(--text-muted); font-size: 1rem; }

/* Search + filter bar */
.shop-toolbar { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.shop-search {
  flex: 1; min-width: 200px; background: var(--input-bg); border: 1px solid var(--input-border);
  color: var(--text); padding: 10px 14px 10px 38px; border-radius: 8px; font-size: 15px;
  font-family: inherit; transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center;
}
.shop-search:focus { outline: none; border-color: var(--primary); }
.shop-search::placeholder { color: var(--text-muted); opacity: 0.6; }

.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text-muted);
  padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.filter-pill:hover { border-color: var(--primary); color: var(--text); }
.filter-pill.active { background: var(--primary-btn, var(--primary)); border-color: var(--primary-btn, var(--primary)); color: #fff; }

/* Product grid */
.product-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.product-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 12px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }

.product-image {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: #1a1a2e;
}
.product-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-brand { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.product-name { font-size: 0.95rem; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
.product-price { font-size: 1.15rem; font-weight: 700; color: var(--primary); margin-top: auto; }
.product-price small { font-size: 0.7rem; font-weight: 400; color: var(--text-muted); }
.product-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.badge { font-size: 0.68rem; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.badge-install { background: rgba(76,175,80,0.15); color: #66BB6A; }
.badge-stock { background: rgba(76,175,80,0.15); color: #66BB6A; }
.badge-low { background: rgba(255,152,0,0.15); color: #FFA726; }
.badge-out { background: rgba(244,67,54,0.15); color: #EF5350; }

.product-add-btn {
  width: 100%; margin-top: 12px; padding: 10px; border: none; border-radius: 8px;
  background: var(--primary-btn, var(--primary)); color: #fff; font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: opacity 0.2s;
}
.product-add-btn:hover { opacity: 0.85; }

/* Empty state */
.shop-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.shop-empty-icon { font-size: 3rem; margin-bottom: 16px; }

/* Product detail modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-content {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 16px; max-width: 700px; width: 100%; max-height: 90vh;
  overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: var(--text-muted); font-size: 1.5rem; cursor: pointer; z-index: 1;
}
.modal-close:hover { color: var(--text); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; }
.modal-image { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px 0 0 16px; }
.modal-info { padding: 28px; display: flex; flex-direction: column; }
.modal-brand { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.modal-name { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin-bottom: 12px; }
.modal-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.modal-specs { font-size: 0.82rem; color: var(--text-muted); line-height: 1.8; margin-bottom: 20px; padding: 12px; background: rgba(255,255,255,0.03); border-radius: 8px; }
.modal-specs span { display: block; }
.modal-price { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.modal-gst { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 16px; }
.modal-add-btn {
  padding: 14px; border: none; border-radius: 10px;
  background: var(--primary-btn, var(--primary)); color: #fff; font-weight: 700; font-size: 1rem;
  cursor: pointer; transition: opacity 0.2s; margin-top: auto;
}
.modal-add-btn:hover { opacity: 0.85; }

/* Cart drawer */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }

.cart-drawer {
  position: fixed; top: 0; right: -420px; width: 400px; max-width: 90vw;
  height: 100dvh; height: 100vh; /* fallback for older browsers */
  background: var(--bg); border-left: 1px solid var(--card-border);
  z-index: 2001; display: flex; flex-direction: column; transition: right 0.3s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@supports (height: 100dvh) {
  .cart-drawer { height: 100dvh; }
}
.cart-drawer.open { right: 0; }

.cart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--card-border);
}
.cart-header h2 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.cart-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }

.cart-items { flex: 1; overflow-y: auto; padding: 16px 24px; }
.cart-item {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--card-border);
}
.cart-item-img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.cart-item-name { font-size: 0.85rem; font-weight: 500; line-height: 1.3; }
.cart-item-price { font-size: 0.8rem; color: var(--primary); font-weight: 600; margin-top: 2px; }
.cart-item-qty {
  display: flex; align-items: center; gap: 8px;
}
.cart-qty-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--card-border);
  background: var(--card-bg); color: var(--text); font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cart-qty-btn:hover { border-color: var(--primary); }
.cart-qty-num { font-size: 0.9rem; font-weight: 600; min-width: 20px; text-align: center; }
.cart-item-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.75rem; }
.cart-item-remove:hover { color: #EF5350; }

.cart-empty { text-align: center; padding: 40px; color: var(--text-muted); }
.cart-empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

.cart-footer { padding: 20px 24px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--card-border); }
.cart-line { display: flex; justify-content: space-between; font-size: 0.88rem; margin-bottom: 6px; }
.cart-line.total { font-weight: 700; font-size: 1.1rem; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--card-border); }
.cart-checkout-btn {
  width: 100%; margin-top: 16px; padding: 14px; border: none; border-radius: 10px;
  background: var(--primary-btn, var(--primary)); color: #fff; font-weight: 700; font-size: 1rem;
  cursor: pointer; transition: opacity 0.2s;
}
.cart-checkout-btn:hover { opacity: 0.85; }

/* Cart badge in header */
.cart-trigger { position: relative; cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; font-weight: 500; }
.cart-count {
  position: absolute; top: -8px; right: -10px; background: var(--primary-btn, var(--primary));
  color: #fff; font-size: 0.65rem; font-weight: 700; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.cart-count:empty { display: none; }

/* Responsive */
@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-image { border-radius: 16px 16px 0 0; max-height: 300px; }
}
@media (max-width: 540px) {
  .shop-page { padding-top: 80px; padding-left: 12px; padding-right: 12px; }
  .shop-title { font-size: 2rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-body { padding: 10px; }
  .product-name { font-size: 0.82rem; }
  .product-price { font-size: 1rem; }
  .product-add-btn { padding: 8px; font-size: 0.8rem; }
  .filter-pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
}
