:root {
  --primary: #137fec;
  --primary-dark: #0b63b8;
  --accent: #eff6ff;
  --surface: #ffffff;
  --border: #dbe3ef;
  --text: #1e293b;
  --muted: #64748b;
  --radius: 18px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --container: 1320px;
  --product-columns: 3;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #f8fafc 0, #eef4fb 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.container { width: min(var(--container), calc(100% - 32px)); margin: 0 auto; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(219, 227, 239, 0.9);
}
.topbar-inner, .nav-links, .toolbar, .hero-actions, .stats-grid, .content-grid, .card-grid,
.summary-list, .mini-meta, .split-2, .feature-list, .filters-head, .checkout-grid, .footer-grid {
  display: flex;
  gap: 16px;
}
.topbar-inner, .footer-grid, .checkout-grid, .content-grid { justify-content: space-between; }
.topbar-inner, .toolbar, .nav-links, .mini-meta, .stats-grid, .feature-list, .hero-actions { align-items: center; }
.topbar-inner { min-height: 84px; }

.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.1rem; }
.brand-mark, .icon-button, .badge-pill, .qty-button, .panel-icon { display: inline-flex; align-items: center; justify-content: center; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #59a6ff);
  color: #fff;
  box-shadow: 0 12px 28px rgba(19, 127, 236, 0.28);
}

.nav-links a { color: var(--muted); font-weight: 600; }
.nav-links a.is-active, .nav-links a:hover, .link-primary { color: var(--primary); }

.search-bar, .field, .select, .textarea, .chip, .summary-card, .panel, .product-card,
.info-card, .hero-card, .tab-strip, .pill-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.search-bar, .field, .select { height: 50px; }
.search-bar, .field, .select, .textarea { width: 100%; padding: 0 16px; color: var(--text); }
.search-bar::placeholder, .field::placeholder, .textarea::placeholder { color: var(--muted); }

.icon-button, .button, .qty-button { border: 0; cursor: pointer; transition: 0.2s ease; }
.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.icon-button:hover, .qty-button:hover { color: var(--primary); background: var(--accent); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 700;
}
.button-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 14px 30px rgba(19, 127, 236, 0.24);
}
.button-secondary { background: var(--surface); border: 1px solid var(--border); color: var(--text); }

.hero { padding: 38px 0 24px; }
.hero-card, .panel, .summary-card, .product-card, .info-card { box-shadow: var(--shadow); }
.hero-card {
  padding: 32px;
  background:
    radial-gradient(circle at top right, rgba(19, 127, 236, 0.16), transparent 34%),
    linear-gradient(180deg, #fff 0, #f9fbff 100%);
}
.eyebrow, .muted, .breadcrumbs, .meta { color: var(--muted); }
.hero-card h1, .page-title, .section-title { margin: 0; line-height: 1.05; }
.hero-card h1 { font-size: clamp(2rem, 4vw, 4rem); max-width: 12ch; }
.page-title { font-size: clamp(1.8rem, 2vw, 2.6rem); }
.hero-copy { max-width: 620px; }
.stats-grid { flex-wrap: wrap; margin-top: 20px; }
.stat {
  min-width: 160px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 227, 239, 0.8);
}
.content-grid { align-items: flex-start; gap: 24px; }
.sidebar { flex: 0 0 310px; }
.main-content { flex: 1 1 auto; }
.panel, .summary-card, .info-card { padding: 24px; }
.accordion details + details, .stack > * + *, .summary-list > * + *, .form-stack > * + *, .sidebar > * + * { margin-top: 16px; }
.accordion summary { cursor: pointer; list-style: none; font-weight: 700; }
.chip, .badge-pill { padding: 8px 12px; font-size: 0.86rem; color: var(--primary); }
.badge-pill { border-radius: 999px; background: rgba(19, 127, 236, 0.1); }
.card-grid { flex-wrap: wrap; }
.product-card { width: calc((100% / var(--product-columns)) - 11px); min-width: 260px; overflow: hidden; background: #fff; }
.view-toggle {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.view-toggle button {
  min-width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
.view-toggle button.is-active {
  background: var(--accent);
  color: var(--primary);
}
.product-media {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 28px;
  background: linear-gradient(180deg, #f8fbff 0, #eef4fb 100%);
}
.product-body { padding: 20px; }
.product-title { font-size: 1.05rem; font-weight: 800; margin: 8px 0 10px; }
.price-row, .between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-grid.is-list {
  display: grid;
  gap: 18px;
}
.card-grid.is-list .product-card {
  width: 100%;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
}
.card-grid.is-list .product-media {
  aspect-ratio: auto;
  min-height: 100%;
}
.card-grid.is-list .product-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card-grid.is-list .price-row {
  margin-top: 10px;
}
.price { font-size: 1.3rem; font-weight: 800; }
.old-price { color: var(--muted); text-decoration: line-through; }
.gallery { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; }
.thumbs { display: grid; gap: 12px; }
.thumbs button, .tab-strip button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
}
.thumbs button.is-active, .tab-strip button.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 127, 236, 0.14);
}
.tab-panel[hidden] { display: none; }
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.qty-button { width: 42px; height: 42px; background: var(--surface); }
.qty input { width: 56px; border: 0; text-align: center; height: 42px; }
.footer {
  margin-top: auto;
  padding: 38px 0;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.84);
}
.quick-view-modal[hidden] { display: none; }
.quick-view-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.quick-view-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.54);
}
.quick-view-dialog {
  position: relative;
  width: min(920px, calc(100% - 32px));
  margin: 5vh auto;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.quick-view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.quick-view-media {
  min-height: 320px;
  background: linear-gradient(180deg, #f8fbff 0, #eef4fb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.quick-view-body {
  padding: 28px;
}
.quick-view-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.action-toast[hidden] { display: none; }
.action-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow);
}
.mobile-toggle { display: none; }

[dir="rtl"] body {
  direction: rtl;
}

[dir="rtl"] .brand,
[dir="rtl"] .topbar-inner,
[dir="rtl"] .nav-links,
[dir="rtl"] .toolbar,
[dir="rtl"] .hero-actions,
[dir="rtl"] .stats-grid,
[dir="rtl"] .content-grid,
[dir="rtl"] .card-grid,
[dir="rtl"] .summary-list,
[dir="rtl"] .mini-meta,
[dir="rtl"] .split-2,
[dir="rtl"] .feature-list,
[dir="rtl"] .filters-head,
[dir="rtl"] .checkout-grid,
[dir="rtl"] .footer-grid,
[dir="rtl"] .price-row,
[dir="rtl"] .between {
  direction: rtl;
}

[dir="rtl"] .gallery {
  grid-template-columns: minmax(0, 1fr) 96px;
}

[dir="rtl"] .thumbs {
  order: 2;
}

[dir="rtl"] .toolbar-search input,
[dir="rtl"] .search-bar,
[dir="rtl"] .field,
[dir="rtl"] .select,
[dir="rtl"] .textarea,
[dir="rtl"] .muted,
[dir="rtl"] .breadcrumbs {
  text-align: right;
}

@media (max-width: 1100px) {
  .sidebar, .product-card { width: 100%; flex-basis: 100%; }
  .content-grid, .checkout-grid, .footer-grid, .split-2, .topbar-inner { flex-direction: column; align-items: stretch; }
  .gallery { grid-template-columns: 1fr; }
  .card-grid.is-list .product-card {
    grid-template-columns: 1fr;
  }
  .quick-view-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .nav-links, .toolbar-search { display: none; }
  .mobile-toggle { display: inline-flex; }
  .topbar.is-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 0 18px;
  }
  .hero-card, .panel, .summary-card, .info-card { padding: 20px; }
}
