/* Shared CSS for landing subpages: sale.html, featured.html, new-arrivals.html, brand.html, search.html */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1E3A8A;
  --primary-hover: #1E40AF;
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --border: #e5e7eb;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --red: #DC2626;
  --green: #059669;
  --orange: #ea580c;
  --white: #ffffff;
}
html, body { font-family: 'Cairo', sans-serif; background: var(--bg); color: var(--text-primary); }
a { text-decoration: none; color: inherit; }

/* Header - matches landing's compact hero style */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: white;
  padding: 12px 18px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(15,23,42,.15);
}
.header-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  flex-shrink: 0;
  text-decoration: none;
}
.header-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.back-btn {
  color: white;
  font-size: 24px;
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 8px;
  transition: background .2s;
  flex-shrink: 0;
}
.back-btn:hover { background: rgba(255,255,255,.15); }
.page-title {
  font-size: 17px;
  font-weight: 800;
  flex-shrink: 0;
  margin-inline-end: 6px;
}
.page-search-input {
  flex: 1;
  min-width: 0;
  padding: 9px 16px;
  border-radius: 100px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,.2);
  color: white;
  outline: none;
  transition: background .15s;
}
.page-search-input::placeholder { color: rgba(255,255,255,.85); }
.page-search-input:focus { background: rgba(255,255,255,.3); }

.header-cart-btn {
  background: white;
  color: var(--primary);
  padding: 8px 14px;
  border-radius: 100px;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  flex-shrink: 0;
  transition: transform .2s;
}
.header-cart-btn:hover { transform: translateY(-1px); }
.header-cart-btn .cart-badge {
  background: var(--red);
  color: white;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 100px;
  font-weight: 800;
}

@media (max-width: 700px) {
  .page-header { padding: 10px 12px; gap: 8px; }
  .page-title { display: none; }
  .header-logo { width: 38px; height: 38px; font-size: 19px; }
  .page-search-input { padding: 8px 14px; font-size: 12px; }
  .header-cart-btn { padding: 7px 12px; font-size: 12px; }
  .header-cart-btn span:not(.cart-badge) { display: none; }
}

/* Main container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: center;
}
.filter-select {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  flex: 1;
  min-width: 130px;
}
.filter-search {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  border-radius: 22px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  background: white;
}
.results-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
@media (max-width: 768px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
@media (max-width: 380px) {
  .products-grid { gap: 6px; }
}

/* Product card */
.product-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  transition: all .25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  content-visibility: auto;
  contain-intrinsic-size: 260px;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}
.product-card .badge {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  z-index: 1;
}
.badge.featured { background: #fef3c7; color: #d97706; }
.badge.sale     { background: #fee2e2; color: #dc2626; }
.badge.new      { background: #d1fae5; color: #059669; }

.product-img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 30px;
  color: var(--text-muted);
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-info {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.product-brand {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
  letter-spacing: .3px;
}
.product-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
  line-height: 1.35;
}
.product-price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}
.price-current {
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
}
.price-old {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: line-through;
}
.btn-add {
  width: 100%;
  padding: 7px;
  border: none;
  background: var(--primary);
  color: white;
  border-radius: 7px;
  font-family: inherit;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  margin-top: 6px;
  transition: background .2s;
}
.btn-add:hover { background: var(--primary-hover); }
.btn-add.in-cart { background: var(--green); }

/* Loading & Empty states */
.skeleton-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.skeleton-card .sk-img {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
.skeleton-card .sk-line {
  height: 11px;
  margin: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.2s ease-in-out infinite;
}
.skeleton-card .sk-line.short { width: 50%; }
@keyframes sk-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.loading, .empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.loading .icon, .empty .icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 30px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  transition: all .2s;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Cart panel - slides in from side */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 200;
  display: none;
  opacity: 0;
  transition: opacity .25s;
}
.cart-overlay.show { display: block; opacity: 1; }

.cart-panel {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  height: 100dvh;
  background: white;
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow: -8px 0 30px rgba(0,0,0,.15);
}
html[dir="rtl"] .cart-panel { transform: translateX(-100%); }
.cart-panel.show,
html[dir="rtl"] .cart-panel.show { transform: translateX(0); }
.cart-header {
  padding: 18px 20px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-header h2 { font-size: 17px; font-weight: 800; }
.cart-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background .2s;
}
.cart-close:hover { background: rgba(255,255,255,.15); }
.cart-continue {
  background: rgba(255,255,255,.2);
  border: none;
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 100px;
  transition: background .2s;
}
.cart-continue:hover { background: rgba(255,255,255,.32); }

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.cart-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--bg-soft);
  border-radius: 10px;
  margin-bottom: 10px;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-price {
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}
.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
}
.cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.cart-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  background: white;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 800;
}
.cart-checkout-btn {
  width: 100%;
  padding: 14px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cart-checkout-btn:hover { background: #20b85a; }

/* Customer-info form buttons (compact, so the send button always fits) */
.cart-back-btn {
  flex: 0 0 auto;
  padding: 12px 16px;
  background: var(--bg-soft);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.cart-back-btn:hover { background: #e2e8f0; }
.cart-submit-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  background: #25d366;
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-submit-btn:hover { background: #20b85a; }
.cart-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Floating cart button (kept for backward compat — but hidden by default) */
.floating-cart { display: none !important; }

/* ─── Mobile Responsive ─── */
@media (max-width: 768px) {
  .container { padding: 12px 8px 60px; }
  .filters-bar { gap: 6px; margin-bottom: 10px; }
  .filter-select { padding: 6px 10px; font-size: 11px; min-width: 100px; }
  .filter-search { font-size: 12px; padding: 7px 12px; }
  .results-count { font-size: 11px; margin-bottom: 8px; }

  .product-card { border-radius: 8px; }
  .product-info { padding: 6px; }
  .product-brand { font-size: 8px; }
  .product-name { font-size: 10px; margin-bottom: 4px; min-height: 36px; line-height: 1.3; -webkit-line-clamp: 3; }
  .price-current { font-size: 13px; }
  .price-old { font-size: 10px; }
  .btn-add { padding: 6px; font-size: 10px; margin-top: 4px; border-radius: 6px; }
  .badge { font-size: 8px; padding: 2px 5px; top: 5px; border-radius: 6px; }

  .pagination { margin-top: 16px; }
  .page-btn { min-width: 30px; height: 30px; font-size: 11px; }

  .cart-panel { max-width: 100%; }
  .cart-header { padding: 12px 14px; }
  .cart-header h2 { font-size: 14px; }
  .cart-item { padding: 8px; gap: 6px; }
  .cart-item-name { font-size: 12px; }
  .cart-item-price { font-size: 12px; }
  .qty-btn { width: 24px; height: 24px; font-size: 12px; }
  .cart-footer { padding: 12px 14px; }
  .cart-total-row { font-size: 13px; }
  .cart-checkout-btn { padding: 11px; font-size: 13px; }
}

@media (max-width: 380px) {
  .container { padding: 10px 6px 60px; }
  .product-info { padding: 5px; }
  .product-name { font-size: 9px; min-height: 32px; -webkit-line-clamp: 3; }
  .price-current { font-size: 12px; }
  .btn-add { padding: 5px; font-size: 9px; }
  .product-img { font-size: 24px; }
}
