:root {
  --navy: #0b1b33;
  --navy-soft: #163056;
  --ink: #142033;
  --muted: #5d6b80;
  --line: #e4e9f2;
  --bg: #f4f6fb;
  --white: #ffffff;
  --accent: #5b4dff;
  --accent-dark: #3f32d6;
  --accent-soft: #efedff;
  --good: #0c8f62;
  --bad: #d3164a;
  --warn: #9a6700;
  --shadow: 0 16px 40px rgba(15, 28, 51, 0.08);
  --radius: 18px;
  --max: 1180px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
button { cursor: pointer; }

.container { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.skip {
  position: absolute; left: 16px; top: -40px; background: white; color: var(--navy);
  padding: 8px 12px; border-radius: 8px; z-index: 80;
}
.skip:focus { top: 12px; }

.storage-banner {
  margin: 0;
  padding: 10px 16px;
  background: #fff6dd;
  color: #6d4d00;
  text-align: center;
  font-size: 14px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 27, 51, 0.96);
  color: white;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(8, 16, 32, 0.18);
}
.header-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  min-height: 78px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: white; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #7d72ff, #3e2fe0);
  font-weight: 800;
}
.logo-type { font-weight: 800; letter-spacing: -0.04em; font-size: 20px; }
.logo-type span { color: #c8c2ff; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: white; border-radius: 999px; padding: 6px 6px 6px 16px; color: var(--ink);
}
.search-icon { width: 18px; height: 18px; color: var(--muted); display: grid; }
.search-icon svg, .tool-icon svg, .wish svg, .nav-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.search input {
  flex: 1; border: 0; outline: none; background: transparent; min-width: 0; padding: 8px 0;
}
.header-tools { display: flex; align-items: center; gap: 8px; }
.tool {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: white; text-decoration: none;
}
.tool:hover, .nav-toggle:hover { background: rgba(255, 255, 255, 0.08); }
.tool em {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 99px; background: #ff4d6d; color: white; font-style: normal; font-size: 11px;
  display: grid; place-items: center; font-weight: 700;
}
.nav-toggle {
  display: none; width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: transparent; color: white;
}
.cat-bar { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.cat-bar .container { display: flex; gap: 6px; overflow: auto; padding: 8px 0 10px; }
.cat-bar a {
  color: rgba(255, 255, 255, 0.82); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px; white-space: nowrap;
}
.cat-bar a.is-active, .cat-bar a:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.mobile-panel { display: none; }
.account { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: white; padding: 4px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 800;
}
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px;
  background: white; color: var(--ink); border-radius: 14px; padding: 8px;
  box-shadow: var(--shadow); display: none;
}
.account-menu.is-open { display: grid; }
.account-menu a, .account-menu button {
  text-align: left; text-decoration: none; background: transparent; border: 0; border-radius: 10px; padding: 10px 12px;
}
.account-menu a:hover, .account-menu button:hover { background: var(--bg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 700;
  text-decoration: none; transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: white; box-shadow: 0 8px 20px rgba(91, 75, 255, 0.25); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-navy { background: var(--navy); color: white; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid #d5dcea; }
.site-header .btn-ghost { color: white; border-color: rgba(255, 255, 255, 0.25); }
.btn-danger { background: #fff1f4; color: var(--bad); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.hero { padding: 42px 0 18px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 36px; align-items: center; }
.eyebrow {
  color: var(--accent-dark); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 12px;
}
.hero h1 { font-size: clamp(40px, 5vw, 64px); line-height: .98; letter-spacing: -0.05em; margin: 12px 0; }
.hero h1 span { color: var(--accent); }
.lede { font-size: 18px; color: var(--muted); max-width: 560px; }
.hero-actions { display: flex; gap: 12px; margin: 22px 0; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 22px; color: var(--muted); font-size: 14px; }
.hero-stats strong { display: block; color: var(--ink); font-size: 20px; }
.hero-visual { position: relative; min-height: 460px; }
.hero-photo {
  height: 460px; border-radius: 28px; overflow: hidden;
  background: #d9e0ee center/cover no-repeat;
  box-shadow: var(--shadow);
}
.hero-card {
  position: absolute; left: -28px; bottom: 28px; width: min(240px, 75%);
  background: white; border-radius: 16px; padding: 10px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: center;
}
.hero-card img { width: 60px; height: 60px; object-fit: cover; border-radius: 12px; }
.hero-card p { color: var(--muted); font-size: 11px; margin: 0; }
.hero-card strong { font-size: 13px; }
.float-note {
  position: absolute; right: 14px; top: 14px; background: white; border-radius: 14px; padding: 10px 12px;
  box-shadow: var(--shadow); font-size: 11px; max-width: 150px;
}
.float-note strong { display: block; font-size: 14px; }

.section { padding: 28px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
.section-head h2, .page-head h1, .dash-main h1 { font-size: 32px; letter-spacing: -0.04em; }
.section-head a { color: var(--accent-dark); font-weight: 700; text-decoration: none; }

.category-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.category-card {
  position: relative; min-height: 150px; border-radius: 18px; overflow: hidden; text-decoration: none; color: white;
  display: flex; align-items: end; padding: 14px; background: #22365a center/cover no-repeat;
}
.category-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent, rgba(8, 16, 32, .75)); }
.category-card span { position: relative; z-index: 1; font-weight: 800; }

.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.product-card {
  background: white; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 0 rgba(15, 28, 51, 0.04);
  border: 1px solid rgba(20, 32, 51, 0.05); display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-media { position: relative; aspect-ratio: 1; background: #eef2f8; overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease; }
.product-card:hover .product-media img { transform: scale(1.05); }
.badge {
  position: absolute; left: 10px; top: 10px; background: var(--navy); color: white;
  border-radius: 999px; padding: 3px 7px; font-size: 10px; font-weight: 800; z-index: 1;
}
.badge-out { background: var(--bad); top: 34px; }
.wish {
  position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: white; color: var(--navy); display: grid; place-items: center; z-index: 1;
}
.wish svg { width: 16px; height: 16px; }
.wish.is-on { color: var(--bad); }
.wish.is-on svg { fill: currentColor; }
.product-body { padding: 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.seller-line { color: var(--accent-dark); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.product-body h3 { font-size: 14px; letter-spacing: -0.02em; line-height: 1.3; }
.product-body h3 a { text-decoration: none; }
.rating-line { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.stars { color: #d7deea; letter-spacing: 0.5px; font-size: 12px; }
.stars .is-on { color: #f5b400; }
.price-row { display: flex; align-items: baseline; gap: 6px; margin: 3px 0 6px; }
.price-row strong { font-size: 16px; }
.price-row s { color: var(--muted); font-size: 12px; }
.product-body .btn { margin-top: auto; font-size: 13px; padding: 10px 14px; }

.offers-layout { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: stretch; }
.offer-banner {
  border-radius: 20px; padding: 20px; color: white;
  background: radial-gradient(circle at top left, #7a6cff, transparent 42%), linear-gradient(160deg, #121a3a, #2a1d78);
  display: flex; flex-direction: column; justify-content: end; min-height: 100%;
}
.offer-banner .eyebrow { color: #ddd8ff; font-size: 10px; }
.offer-banner h2 { font-size: 24px; letter-spacing: -0.04em; margin: 6px 0 12px; line-height: 1.2; }
.offer-banner .btn { padding: 10px 14px; font-size: 13px; }
.offer-grid { display: grid; gap: 14px; }

.seller-grid, .review-grid, .feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.seller-card, .review-card, .feature-card, .panel, .summary, .auth-card, .detail-card {
  background: white; border-radius: var(--radius); padding: 18px; border: 1px solid rgba(20, 32, 51, 0.05);
  min-height: 0; /* تعديل: منع الارتفاع الزائد */
}
.feature-card, .review-card {
  display: flex;
  flex-direction: column;
  height: 100%; /* تعديل: جعل الارتفاع متساوي */
}
.feature-card p, .review-card p {
  flex: 1; /* تعديل: السماح بالنمو المتساوي */
  overflow: hidden;
}
.seller-card { text-decoration: none; display: block; }
.seller-top { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.seller-card p, .review-card p, .feature-card p { color: var(--muted); line-height: 1.6; }
.seller-card p { 
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.review-card span, .muted { color: var(--muted); }
.feature-card h3 { margin-bottom: 6px; font-size: 18px; }
.feature-card { min-height: 160px; }
.review-card { min-height: 180px; }
.seller-card { min-height: 140px; }

.newsletter {
  margin: 20px 0 10px; border-radius: 28px; padding: 32px;
  background: var(--navy); color: white;
  display: flex; justify-content: space-between; gap: 24px; align-items: center;
}
.newsletter h2 { font-size: 32px; letter-spacing: -0.04em; margin-top: 6px; }
.newsletter form { display: flex; gap: 8px; background: white; padding: 6px; border-radius: 999px; min-width: min(420px, 100%); }
.newsletter input { border: 0; outline: none; flex: 1; padding: 8px 12px; min-width: 0; }

.site-footer { background: #081423; color: rgba(255, 255, 255, 0.78); margin-top: 28px; padding: 42px 0 18px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
.site-footer h2 { color: white; font-size: 14px; margin-bottom: 10px; }
.site-footer a { display: block; color: rgba(255, 255, 255, 0.78); text-decoration: none; margin: 6px 0; }
.site-footer a:hover { color: white; }
.footer-note { border-top: 1px solid rgba(255, 255, 255, 0.08); margin-top: 24px; padding-top: 14px; font-size: 13px; }

.page { padding: 28px 0 48px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
.catalog { display: grid; grid-template-columns: 260px 1fr; gap: 18px; }
.filters, .toolbar, .cart-list, .detail-grid > * { }
.filters { background: white; border-radius: var(--radius); padding: 16px; height: fit-content; position: sticky; top: 132px; }
.filters h2 { font-size: 16px; margin-bottom: 10px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span, .check { font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea, .qty input {
  width: 100%; border: 1px solid var(--line); background: #fbfcff; border-radius: 12px; padding: 12px 12px;
}
.field textarea { min-height: 110px; resize: vertical; }
.price-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.toolbar select { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: white; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.pager a, .pager span { min-width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; text-decoration: none; background: white; }
.pager .is-active { background: var(--navy); color: white; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.gallery { background: white; border-radius: 20px; overflow: hidden; min-height: 320px; }
.gallery img { width: 100%; height: 380px; object-fit: cover; }
.detail-card { padding: 20px; }
.detail-card h1 { font-size: 26px; letter-spacing: -0.04em; margin: 4px 0; }
.detail-card .seller-line { font-size: 10px; }
.detail-card .rating-line { font-size: 12px; gap: 4px; }
.detail-card .price-row strong { font-size: 22px; }
.detail-card .price-row s { font-size: 16px; }
.detail-actions { display: flex; gap: 8px; margin: 14px 0; }
.detail-actions .btn { padding: 11px 16px; font-size: 14px; }
.qty { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.qty input { width: 70px; text-align: center; padding: 10px 8px; }
.notice {
  background: var(--accent-soft); color: #3229a5; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 13px;
}
.detail-card p { font-size: 14px; line-height: 1.6; }
.review-list { display: grid; gap: 10px; margin-top: 12px; }
.related { margin-top: 24px; }
.related .section-head h2 { font-size: 24px; }
.related .product-grid { gap: 14px; }

.cart-layout, .checkout-layout { display: grid; grid-template-columns: 1.4fr .7fr; gap: 18px; align-items: start; }
.cart-item, .summary { background: white; border-radius: var(--radius); }
.cart-item {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; padding: 14px; margin-bottom: 12px; align-items: center;
}
.cart-item img { width: 92px; height: 92px; object-fit: cover; border-radius: 14px; }
.summary { padding: 18px; position: sticky; top: 132px; }
.summary-row, .total-row { display: flex; justify-content: space-between; margin: 8px 0; }
.total-row { font-size: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.pay-box { display: grid; gap: 8px; margin: 8px 0 14px; }
.pay-option { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.success-box { text-align: center; padding: 28px 10px; }
.success-box strong { font-size: 28px; letter-spacing: -0.04em; display: block; margin: 8px 0; }

.empty { background: white; border-radius: var(--radius); padding: 36px; text-align: center; }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); margin-bottom: 14px; }

.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 70; }
.toast { margin: 0; background: var(--navy); color: white; border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); max-width: 320px; }
.toast.is-err { background: #7d1230; }
.dialog { position: fixed; inset: 0; background: rgba(8, 16, 32, .5); display: grid; place-items: center; z-index: 80; padding: 16px; }
.dialog[hidden] { display: none; }
.dialog-card { width: min(420px, 100%); background: white; border-radius: 18px; padding: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-error { color: var(--bad); min-height: 1.2em; font-size: 14px; font-weight: 700; }

:focus-visible { outline: 3px solid rgba(91, 75, 255, .45); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
