/* ============================================================================
   YIWU — Design System
   Modern 2026 B2B marketplace. Deep-red brand, glassmorphism, motion, dark mode.
   Mobile-first & fully responsive. RTL-aware.
   ============================================================================ */

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --red-50:  #fef2f3;
  --red-100: #fde3e5;
  --red-200: #fbccd0;
  --red-300: #f7a5ac;
  --red-400: #f17580;
  --red-500: #e63e4d;
  --red-600: #d11f30;
  --red-700: #c1121f;   /* PRIMARY — Deep Red */
  --red-800: #a10f1b;
  --red-900: #85121c;
  --crimson: #dc143c;

  /* Neutrals */
  --white:   #ffffff;
  --gray-50: #f8f9fb;
  --gray-100:#f1f3f6;
  --gray-200:#e6e9ee;
  --gray-300:#d3d9e0;
  --gray-400:#9aa3af;
  --gray-500:#6b7280;
  --gray-600:#4b5563;
  --gray-700:#374151;
  --gray-800:#1f2530;
  --gray-900:#11151c;
  --charcoal:#15181f;

  /* Semantic (light) */
  --bg:          var(--gray-50);
  --bg-elevated: var(--white);
  --surface:     var(--white);
  --surface-2:   var(--gray-50);
  --border:      var(--gray-200);
  --border-soft: var(--gray-100);
  --text:        var(--gray-900);
  --text-soft:   var(--gray-600);
  --text-muted:  var(--gray-500);
  --primary:     var(--red-700);
  --primary-h:   var(--red-800);
  --on-primary:  #ffffff;
  --ring:        rgba(193,18,31,.35);

  /* Glass */
  --glass-bg:     rgba(255,255,255,.72);
  --glass-border: rgba(255,255,255,.55);
  --glass-blur:   16px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(16,24,40,.05);
  --shadow-sm: 0 2px 8px rgba(16,24,40,.06);
  --shadow-md: 0 8px 24px rgba(16,24,40,.08);
  --shadow-lg: 0 16px 48px rgba(16,24,40,.12);
  --shadow-red: 0 10px 30px rgba(193,18,31,.28);

  /* Radii */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* Type */
  --font: "Inter", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;

  /* Layout */
  --container: 1240px;
  --header-h: 72px;

  /* Motion */
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --dur: .28s;
}

/* ── Dark Mode ───────────────────────────────────────────────────────────── */
html.dark {
  --bg:          #0b0e13;
  --bg-elevated: #11151c;
  --surface:     #151a22;
  --surface-2:   #1b212b;
  --border:      #262d39;
  --border-soft: #1d2330;
  --text:        #eef1f6;
  --text-soft:   #aab2c0;
  --text-muted:  #7e8796;
  --primary:     var(--red-500);
  --primary-h:   var(--red-400);
  --ring:        rgba(230,62,77,.4);
  --glass-bg:     rgba(17,21,28,.7);
  --glass-border: rgba(255,255,255,.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
}

/* ── Reset / Base ────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
ul { list-style: none; padding: 0; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.section { padding-block: clamp(40px, 7vw, 84px); }
.section-tight { padding-block: clamp(28px, 5vw, 56px); }
.stack > * + * { margin-top: 1rem; }

.section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head .eyebrow { color: var(--primary); font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.section-head h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.section-head p { color: var(--text-soft); margin-top: 6px; max-width: 56ch; }
.section-head .link-all { color: var(--primary); font-weight: 700; white-space: nowrap; display:inline-flex; align-items:center; gap:6px; }
.section-head .link-all:hover { gap: 10px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--r-full); border: 1px solid transparent;
  font-weight: 700; font-size: .95rem; line-height: 1; white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-red); }
.btn-primary:hover { background: var(--primary-h); transform: translateY(-2px); box-shadow: 0 14px 36px rgba(193,18,31,.36); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--gray-300); transform: translateY(-2px); }
.btn-glass { background: var(--glass-bg); color: var(--text); border-color: var(--glass-border); backdrop-filter: blur(10px); }
.btn-glass:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-lg { padding: 15px 28px; font-size: 1.02rem; }
.btn-sm { padding: 9px 16px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ── Badges / chips ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; line-height: 1.4;
}
.badge-verified { background: #e8f5ee; color: #1a7f4b; }
.badge-premium  { background: #eef0ff; color: #4338ca; }
.badge-gold     { background: linear-gradient(135deg,#fff4d6,#ffe8a8); color: #8a6300; }
.badge-new      { background: var(--red-50); color: var(--red-700); }
.badge-soft     { background: var(--surface-2); color: var(--text-soft); border:1px solid var(--border); }
html.dark .badge-verified { background: rgba(26,127,75,.18); color:#54d394; }
html.dark .badge-premium  { background: rgba(67,56,202,.22); color:#a5b4fc; }
html.dark .badge-gold     { background: linear-gradient(135deg,#3a2f12,#4a3a14); color:#ffd97a; }

.chip {
  display:inline-flex; align-items:center; gap:6px;
  padding: 7px 14px; border-radius: var(--r-full);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-soft); font-weight: 600; font-size: .85rem;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; }

/* Product card */
.product-card { display: flex; flex-direction: column; height: 100%; }
.product-card .media { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--surface-2); }
.product-card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.product-card:hover .media img { transform: scale(1.07); }
.product-card .media .flags { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.product-card .fav {
  position: absolute; top: 10px; inset-inline-end: 10px;
  width: 38px; height: 38px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--glass-bg); backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border); color: var(--text-soft);
  opacity: 0; transform: translateY(-6px); transition: all var(--dur) var(--ease);
}
.product-card:hover .fav { opacity: 1; transform: translateY(0); }
.product-card .fav:hover { color: var(--primary); background: var(--white); }
.product-card .fav.active { color: var(--primary); opacity: 1; transform: translateY(0); }
.product-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-card .title { font-weight: 700; font-size: .98rem; line-height: 1.35; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card:hover .title { color: var(--primary); }
.product-card .price { font-weight: 800; color: var(--text); font-size: 1.05rem; }
.product-card .price small { color: var(--text-muted); font-weight: 600; font-size: .78rem; }
.product-card .meta { display:flex; align-items:center; gap:8px; color: var(--text-muted); font-size: .8rem; margin-top:auto; }
.product-card .supplier { display:flex; align-items:center; gap:7px; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--border-soft); font-size:.82rem; color: var(--text-soft); }
.product-card .supplier .logo { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; flex: none; }

/* Category card */
.cat-card {
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap: 12px;
  text-align:center; padding: 22px 14px;
  background: var(--surface); border:1px solid var(--border); border-radius: var(--r-lg);
  transition: all var(--dur) var(--ease-out);
}
.cat-card:hover { transform: translateY(-6px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.cat-card .glyph {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center;
  font-size: 26px; color: var(--primary);
  background: linear-gradient(135deg, var(--red-50), var(--red-100));
  transition: transform var(--dur) var(--ease);
}
html.dark .cat-card .glyph { background: linear-gradient(135deg, rgba(193,18,31,.18), rgba(193,18,31,.08)); }
.cat-card:hover .glyph { transform: scale(1.1) rotate(-4deg); }
.cat-card .name { font-weight: 700; font-size: .92rem; }
.cat-card .count { color: var(--text-muted); font-size: .78rem; }

/* Supplier card */
.supplier-card { display:flex; flex-direction:column; height:100%; }
.supplier-card .cover { height: 92px; background: linear-gradient(120deg, var(--red-700), var(--crimson)); position: relative; }
.supplier-card .cover::after { content:""; position:absolute; inset:0; background: radial-gradient(circle at 80% -20%, rgba(255,255,255,.35), transparent 60%); }
.supplier-card .logo {
  width: 64px; height: 64px; border-radius: 16px; object-fit: cover;
  border: 3px solid var(--surface); background: var(--surface);
  margin-top: -32px; margin-inline-start: 18px; position: relative; z-index: 1; box-shadow: var(--shadow-sm);
}
.supplier-card .body { padding: 10px 18px 18px; display:flex; flex-direction:column; gap:8px; flex:1; }
.supplier-card .cname { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.supplier-card:hover .cname { color: var(--primary); }
.supplier-card .loc { color: var(--text-muted); font-size: .82rem; display:flex; align-items:center; gap:5px; }
.supplier-card .tags { display:flex; gap:6px; flex-wrap:wrap; }
.supplier-card .stats { display:flex; gap:16px; margin-top:auto; padding-top:12px; border-top:1px solid var(--border-soft); font-size:.8rem; color:var(--text-soft); }
.supplier-card .stats b { color: var(--text); display:block; font-size:.95rem; }

/* ── Glass / utility ─────────────────────────────────────────────────────── */
.glass { background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%); border: 1px solid var(--glass-border); }
.text-gradient { background: linear-gradient(100deg, var(--red-600), var(--crimson) 60%, var(--red-800));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.divider { height:1px; background: var(--border); border:0; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes floatUp { from { opacity:0; transform: translateY(24px); } to { opacity:1; transform:none; } }
@keyframes blob { 0%,100%{ transform: translate(0,0) scale(1);} 33%{ transform: translate(30px,-20px) scale(1.1);} 66%{ transform: translate(-20px,20px) scale(.95);} }
@keyframes shimmer { 100% { background-position: 200% 0; } }
@keyframes pulseRing { 0%{ box-shadow:0 0 0 0 var(--ring);} 70%{ box-shadow:0 0 0 12px rgba(193,18,31,0);} 100%{ box-shadow:0 0 0 0 rgba(193,18,31,0);} }
@keyframes marquee { from { transform: translateX(0);} to { transform: translateX(-50%);} }

.reveal { opacity: 0; }
.reveal.in { animation: floatUp .7s var(--ease-out) forwards; }
.reveal.d1 { animation-delay: .08s; } .reveal.d2{ animation-delay:.16s; }
.reveal.d3 { animation-delay: .24s; } .reveal.d4{ animation-delay:.32s; }
.reveal.d5 { animation-delay: .4s; }  .reveal.d6{ animation-delay:.48s; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border-soft) 37%, var(--surface-2) 63%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1 !important; }
}

/* ── RTL niceties ────────────────────────────────────────────────────────── */
html[dir="rtl"] body { font-family: "Noto Sans Arabic", var(--font); }
html[dir="rtl"] .link-all svg, html[dir="rtl"] .arrow-ico { transform: scaleX(-1); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; border: 3px solid var(--bg); }
html.dark ::-webkit-scrollbar-thumb { background: #2a323e; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
