:root {
  --bg: #0b1220;
  --bg-card: #111827;
  --bg-elevated: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --accent: #22c55e;
  --danger: #ef4444;
  --border: #1e293b;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  --font-ar: 'Cairo', system-ui, sans-serif;
  --font-en: 'Inter', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-en);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.lang-ar { font-family: var(--font-ar); }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; display: block; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.container.narrow { max-width: 640px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.15rem;
}
.logo:hover { color: var(--text); }
.logo-icon { font-size: 1.4rem; }

.main-nav {
  display: flex;
  gap: 8px;
}
.main-nav a {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--text);
  background: var(--bg-elevated);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: flex;
  background: var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
}
.lang-switch a {
  padding: 6px 10px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
}
.lang-switch a.active {
  background: var(--primary);
  color: #fff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* Notif banner */
.notif-banner {
  background: linear-gradient(135deg, #1e3a5f, #0f766e);
  color: #fff;
  padding: 12px 16px;
  position: relative;
  z-index: 200;
}
.notif-banner.hidden { display: none; }
.notif-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.notif-icon { font-size: 1.6rem; }
.notif-text { flex: 1; min-width: 200px; }
.notif-text strong { display: block; margin-bottom: 2px; }
.notif-text span { font-size: 0.9rem; opacity: 0.9; }
.notif-actions { display: flex; gap: 8px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-elevated); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Hero */
.hero {
  padding: 40px 0 24px;
  text-align: center;
  background: radial-gradient(ellipse at top, #1e293b 0%, transparent 60%);
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 8px;
}
.hero-sub {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1.05rem;
}

.search-bar {
  display: flex;
  max-width: 480px;
  margin: 0 auto 20px;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.search-bar input:focus { border-color: var(--primary); }

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.filter-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Products grid */
.products-section { padding: 24px 0 48px; flex: 1; }

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

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #334155;
}
.product-card.highlight {
  animation: pulse-border 1.5s ease;
}
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.15); }
}

.product-link { color: inherit; flex: 1; display: flex; flex-direction: column; }
.product-link:hover { color: inherit; }

.product-image-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-elevated);
  overflow: hidden;
}
.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
}
.badge.discount {
  inset-inline-start: 10px;
  background: var(--danger);
  color: #fff;
}
.badge.featured {
  inset-inline-end: 10px;
  background: var(--accent);
  color: #0b1220;
}

.product-body { padding: 14px 16px 8px; flex: 1; }
.product-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-meta { margin-bottom: 6px; }
.price {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
}
.price small { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }

.product-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.product-time time { font-weight: 600; }

.product-actions { padding: 0 16px 16px; }

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

.load-more-wrap {
  text-align: center;
  margin-top: 32px;
}

/* Product detail */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  padding: 24px 0;
}
.product-detail-image {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.product-detail-image img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.product-detail-info h1 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}
.product-meta.large .price { font-size: 1.6rem; }
.product-detail-info .product-time { margin: 16px 0 24px; font-size: 0.95rem; }
.tz { opacity: 0.6; font-size: 0.85em; }

/* Page section */
.page-section { padding: 40px 0 60px; flex: 1; }
.page-section h1 { margin-bottom: 24px; font-size: 1.8rem; }
.prose { line-height: 1.8; }
.prose p { margin-bottom: 12px; }
.text-center { text-align: center; }

/* Contact form */
.contact-form { margin-top: 8px; }
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--primary); }

.form-result {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
}
.form-result.success { background: rgba(34, 197, 94, 0.15); color: var(--accent); }
.form-result.error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.form-result.hidden { display: none; }

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-brand p {
  color: var(--text-muted);
  margin-top: 12px;
  font-size: 0.9rem;
}
.footer-links h4 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.footer-links a {
  display: block;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer-bottom .developer { margin-top: 6px; }
.footer-bottom a { color: var(--primary); }

.flash-container { padding: 12px 0 0; }
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-weight: 600;
}
.flash-success { background: rgba(34,197,94,.15); color: var(--accent); }
.flash-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.flash-warning { background: rgba(249,115,22,.15); color: var(--primary); }

/* Mobile */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    flex-direction: column;
    padding: 12px;
    border-bottom: 1px solid var(--border);
  }
  .main-nav.open { display: flex; }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .product-detail {
    grid-template-columns: 1fr;
  }
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .product-title { font-size: 0.85rem; }
  .price { font-size: 1.05rem; }
  .notif-banner-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 400px) {
  .products-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Logo image */
.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}
.footer-brand .logo-img { width: 32px; height: 32px; }

/* Header notif button */
.notif-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
}
.notif-header-btn:hover { color: var(--text); border-color: var(--primary); }
.notif-header-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.notif-bell { font-size: 1rem; }
@media (max-width: 640px) {
  .notif-label { display: none; }
}

/* Live indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}
.live-indicator.connected .live-dot {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse-live 1.5s infinite;
}
@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.pagination .page-info {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.btn.disabled, .btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 12px;
  z-index: 999;
  box-shadow: var(--shadow);
  max-width: 90vw;
  text-align: center;
  font-size: 0.9rem;
}
.toast.hidden { display: none; }
.toast strong { color: var(--primary); }

/* New badge + animation */
.badge.new-badge {
  top: auto;
  bottom: 10px;
  inset-inline-start: 10px;
  background: #3b82f6;
  color: #fff;
}
.product-card.flash-in {
  animation: flash-in 0.5s ease;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}
