@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&family=Noto+Nastaliq+Urdu:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

/* ─── Dark theme (default) ─── */
:root, [data-theme="dark"] {
  --bg: #07080a;
  --bg2: #0d0f12;
  --surface: #13151a;
  --surface2: #1a1d24;
  --border: #23272f;
  --border2: #2d323c;
  --text: #f0f2f5;
  --text2: #a0a8b8;
  --text3: #6b7280;
  --accent: #3b82f6;
  --accent2: #2563eb;
  --accent-glow: rgba(59,130,246,0.15);
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --card-shadow: 0 4px 24px rgba(0,0,0,0.4);
  --header-bg: rgba(7,8,10,0.85);
  --gradient-hero: linear-gradient(135deg, #0a1628 0%, #0f1b2e 40%, #0a0f1a 100%);
}

/* ─── Light theme ───
   Backgrounds are intentionally cool/grey so white card surfaces visibly
   stand out (instead of blending into a white-on-white page). Borders are
   stronger and the card shadow gives elevation. ───────────────────────── */
[data-theme="light"] {
  --bg: #eceff4;           /* page background – soft cool blue-grey */
  --bg2: #e1e6ee;          /* deeper for nested elevated areas */
  --surface: #ffffff;      /* card / panel white */
  --surface2: #f4f7fb;     /* hover / subtle surface */
  --surface3: #fbfcfe;     /* near-white raised surface (modals, fields) */
  --border: #dde3ec;       /* soft hairline border */
  --border2: #c4ccd8;      /* stronger border for focus / dividers */
  --text: #0b1220;         /* darker, stronger titles */
  --text2: #4a5568;
  --text3: #707a8a;        /* softer secondary grey */
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --accent-glow: rgba(37,99,235,0.12);
  --green: #16a34a;
  --red: #dc2626;
  --orange: #d97706;
  /* Premium layered shadows — soft, wide, low-opacity (Stripe/Linear feel) */
  --card-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 30px -12px rgba(15,23,42,0.10);
  --elevated-shadow: 0 4px 12px -4px rgba(15,23,42,0.08), 0 18px 40px -16px rgba(15,23,42,0.16);
  --modal-shadow: 0 24px 60px -12px rgba(15,23,42,0.28), 0 0 0 1px rgba(15,23,42,0.04);
  --header-bg: rgba(236,239,244,0.85);
  --gradient-hero: linear-gradient(135deg, #dbeafe 0%, #eff6ff 40%, #f4f6f9 100%);
}

/* Provide a baseline --elevated-shadow for dark theme too (was missing) */
:root, [data-theme="dark"] { --elevated-shadow: 0 8px 24px rgba(0,0,0,0.45); }

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body, html[lang="ar"] input, html[lang="ar"] select, html[lang="ar"] textarea, html[lang="ar"] button { font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', system-ui, sans-serif; }
html[lang="fa"] body, html[lang="fa"] input, html[lang="fa"] select, html[lang="fa"] textarea, html[lang="fa"] button { font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', system-ui, sans-serif; }
html[lang="ur"] body, html[lang="ur"] input, html[lang="ur"] select, html[lang="ur"] textarea, html[lang="ur"] button { font-family: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', system-ui, sans-serif; }
html[lang="hi"] body, html[lang="hi"] input, html[lang="hi"] select, html[lang="hi"] textarea, html[lang="hi"] button { font-family: 'Noto Sans Devanagari', 'Plus Jakarta Sans', system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent2); }
img { max-width: 100%; height: auto; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ─── Container ─── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ─── Top Nav ─── */
.top-bar {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  transition: background .3s;
}
[data-theme="light"] .top-bar {
  border-bottom-color: var(--border2);
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text);
}
.brand .x { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  color: var(--text2);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link-accent {
  color: var(--accent) !important;
  font-weight: 600;
}
.nav-link-accent:hover { background: var(--accent-glow); }

/* Hamburger */
.nav-hamburger {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; cursor: pointer; color: var(--text2);
  display: none; align-items: center; justify-content: center;
  transition: all .2s;
}
.nav-hamburger:hover, .nav-hamburger.active { color: var(--text); border-color: var(--accent); background: var(--surface2); }
.hide-desktop { display: none; }

/* Mobile dropdown menu */
.nav-mobile-menu {
  display: none; flex-direction: column;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 16px 16px;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-link {
  color: var(--text2); padding: 12px 16px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 500; transition: all .2s;
  text-decoration: none;
}
.nav-mobile-link:hover { color: var(--text); background: var(--surface2); }

/* ─── Language select ─── */
#lang-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text2);
  cursor: pointer;
  outline: none;
  appearance: auto;
}

/* ─── Theme toggle ─── */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text2);
  display: flex;
  align-items: center;
  transition: all .2s;
}
#theme-toggle:hover { color: var(--text); border-color: var(--border2); background: var(--surface2); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
  transition: all .25s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px rgba(59,130,246,0.3);
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
  transform: translateY(-1px);
  color: #fff;
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border2);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: none;
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-sm { padding: 6px 16px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: 12px; }

/* View Detail button — solid accent so it's always readable in any theme */
.btn-detail {
  background: var(--accent) !important;
  color: #fff !important;
  border: 1.5px solid var(--accent) !important;
  font-weight: 600;
}
.btn-detail:hover {
  background: var(--accent2) !important;
  border-color: var(--accent2) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(59,130,246,0.45);
  transform: translateY(-1px);
}

/* Inline supplier link inside product cards (shows IG-style tick next to name) */
.product-supplier .supplier-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}
.product-supplier .supplier-link:hover { color: var(--accent); }

/* Instagram-style verified badge (8-point star with white check) — site-wide */
.ig-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  margin-inline-start: 4px;
}
.ig-tick svg { display: block; }
.ig-tick-lg { width: 22px; height: 22px; }
.ig-tick-lg svg { width: 22px; height: 22px; }

/* Square product images site-wide */
.product-image,
.product-card .product-image,
.search-result-img,
.material-card .card-image,
.material-card-img,
.product-img,
.related-product-img {
  aspect-ratio: 1 / 1 !important;
  width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
  background: var(--surface, rgba(255,255,255,0.04));
}

/* Navbar notifications */
.nav-notif { position: relative; }
.nav-notif-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-notif-btn:hover { background: var(--surface2); border-color: var(--accent); }
.nav-notif-dot {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  background: #ef4444;
  color: #fff;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}
.nav-notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 360px;
  max-height: 480px;
  background: var(--card, var(--surface));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  z-index: 1000;
}
[data-theme="light"] .nav-notif-panel {
  box-shadow: 0 12px 32px rgba(15,23,42,0.12);
}
.nav-notif-panel.open { display: flex; }
.nav-notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.link-btn { background: none; border: none; color: var(--accent); font-size: 0.8rem; cursor: pointer; }
.nav-notif-list { flex: 1; overflow-y: auto; max-height: 380px; }
.navnotif-empty { text-align: center; padding: 30px 16px; color: var(--text3); font-size: 0.85rem; }
.navnotif-item {
  display: flex; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.navnotif-item:hover { background: var(--surface2); }
.navnotif-item.unread { background: rgba(0,149,246,0.06); }
.navnotif-icon { font-size: 1.2rem; flex-shrink: 0; }
.navnotif-body { flex: 1; min-width: 0; }
.navnotif-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 2px; }
.navnotif-content {
  font-size: 0.78rem; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.navnotif-time { font-size: 0.7rem; color: var(--text3); margin-top: 3px; }
.nav-notif-foot {
  text-align: center;
  padding: 10px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

@media (max-width: 600px) {
  .nav-notif-panel { width: calc(100vw - 32px); inset-inline-end: -8px; }
}

/* ─── Form inputs ─── */
.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input::placeholder { color: var(--text3); }

/* ─── Section headings ─── */
.section { padding: 80px 0; }
.section-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 48px;
  letter-spacing: -0.02em;
}
.section-title .accent { color: var(--accent); }

/* ─── Show more button ─── */
.section-more {
  text-align: center;
  margin-top: 40px;
}

/* ─── Fade-up animation ─── */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .6s ease, transform .6s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-stock { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-oos { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-verified { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-discount {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #16A34A, #22C55E);
  color: #fff !important; font-weight: 800; letter-spacing: 0.4px;
  box-shadow: 0 4px 14px rgba(34,197,94,0.45);
  border: 1.5px solid rgba(255,255,255,0.25);
  margin-inline-start: 6px;
}
.price-old {
  color: rgba(148,163,184,0.85);
  text-decoration: line-through;
  font-weight: 500;
  margin-inline-end: 6px;
  font-size: 0.9em;
}
.price-new { color: #22C55E; font-weight: 700; }

/* ─── Product cards ─── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all .3s;
}
.product-card:hover {
  border-color: var(--accent);
  box-shadow: var(--card-shadow), 0 0 0 1px var(--accent);
  transform: translateY(-4px);
}
.product-img {
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface2);
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px;
}
.product-body { padding: 16px; }
.product-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-supplier {
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 10px;
}
.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text2);
}
.product-meta span { display: inline-flex; align-items: center; gap: 4px; }
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.product-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  max-width: 520px;
  width: 90%;
  text-align: center;
}
.modal-box h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; }
.modal-box p { color: var(--text2); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ─── Alerts ─── */
.alert {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 16px;
  animation: slideIn .3s ease;
}
.alert:empty { display: none; }
.alert-error { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }

/* ─── Spinner ─── */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 60px auto;
}

/* ─── Footer ─── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 60px 0 30px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}
.footer-brand { font-size: 1.5rem; font-weight: 800; margin-bottom: 12px; }
.footer-brand .x { color: var(--accent); }
.footer-desc { color: var(--text3); font-size: 0.88rem; line-height: 1.7; }
.footer-heading {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  margin-bottom: 16px;
}
.footer-links-list { list-style: none; }
.footer-links-list li { margin-bottom: 10px; }
.footer-links-list a { color: var(--text3); font-size: 0.88rem; transition: color .2s; }
.footer-links-list a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  text-align: center;
  color: var(--text3);
  font-size: 0.8rem;
}

/* ─── Grain overlay ─── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Animations ─── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }

.no-results { text-align: center; color: var(--text3); padding: 60px 20px; font-size: 1rem; }

/* ─── Global RTL polish ─────────────────────────────────────────────
   Most layout uses logical properties already. These rules flip a handful
   of remaining physical-side helpers so RTL languages (Arabic / Persian /
   Urdu) render correctly without each page having to special-case them. */
[dir="rtl"] .product-supplier .supplier-link svg,
[dir="rtl"] .ig-tick svg { transform: none; }
[dir="rtl"] .modal-actions { direction: rtl; }
[dir="rtl"] .alert { text-align: start; }
/* Arrow glyphs in button text — keep direction-natural so "→" feels
   forward in both LTR and RTL flows. */
[dir="rtl"] .arrow-fwd { display: inline-block; transform: scaleX(-1); }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 9000;
  opacity: 0;
  transition: all .3s ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--green); color: #fff; box-shadow: 0 8px 32px rgba(34,197,94,0.3); }
.toast-error { background: var(--red); color: #fff; box-shadow: 0 8px 32px rgba(239,68,68,0.3); }

/* ─── Mobile ─── */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 768px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .section { padding: 48px 0; }
  .section-title { font-size: 1.5rem; margin-bottom: 32px; }
  .hide-mobile, .nav-links.hide-mobile { display: none !important; }
  .hide-desktop, .nav-hamburger { display: flex !important; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .top-bar { height: 56px; }
  .container { padding: 0 16px; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
  .modal-box { padding: 24px 16px; width: 95%; }
  .nav-inner { padding: 0 12px; gap: 8px; }
  .brand { font-size: 1.2rem; }
  #lang-select { padding: 4px 8px; font-size: 0.75rem; }
  .btn-sm { padding: 5px 12px; font-size: 0.78rem; }
}
