/* ==========================================================================
   DXF & CDR Hub - Global Design System & Theming (Dark & Light Mode)
   ========================================================================== */

:root {
  --bg-body: #0f172a;
  --bg-surface: #111827;
  --bg-header: #0b1220;
  --bg-hero: linear-gradient(135deg, #0b1220 0%, #134e6f 100%);
  --bg-subtle: #0b1220;
  --border-color: #1e293b;
  --border-subtle: #334155;
  --text-main: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-text: #0b1220;
  --card-bg: #111827;
  --card-border: #1e293b;
  --chip-bg: #1e293b;
  --chip-border: #334155;
  --chip-text: #94a3b8;
  --search-bg: #0f172a;
  --search-border: #334155;
  --counter-bg: #0f172a;
  --table-th-bg: #1e293b;
  --table-td-bg: #0b1220;
  --download-box-bg: #1e293b;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --footer-bg: #020617;
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-header: #ffffff;
  --bg-hero: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-text: #ffffff;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --chip-bg: #f1f5f9;
  --chip-border: #e2e8f0;
  --chip-text: #475569;
  --search-bg: #ffffff;
  --search-border: #cbd5e1;
  --counter-bg: #f1f5f9;
  --table-th-bg: #f1f5f9;
  --table-td-bg: #ffffff;
  --download-box-bg: #f0f9ff;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --footer-bg: #f1f5f9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { transition: background-color .3s ease, color .3s ease; }
html[lang="en"] body { font-family: 'Segoe UI', system-ui, -apple-system, Tahoma, Arial, sans-serif; }
html[lang="ar"] body { font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, Tahoma, Arial, sans-serif; }
body { background: var(--bg-body); color: var(--text-body); line-height: 1.65; transition: background-color .3s ease, color .3s ease; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.2rem; }

/* Language-switching */
.ar-text { display: none; }
.en-text { display: none; }
html[lang="ar"] .ar-text,
html[lang="en"] .en-text { display: inline; }

/* Header & Navigation */
.site-header { background: var(--bg-header); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; transition: background-color .3s ease, border-color .3s ease; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; padding-top: .9rem; padding-bottom: .9rem; }
.logo { font-weight: 900; font-size: 1.3rem; color: var(--accent); text-decoration: none; letter-spacing: .02em; }

/* Header Actions (Language & Theme Toggles) */
.header-actions, .nav-actions { display: flex; align-items: center; gap: .6rem; }
.lang-switch { display: flex; gap: .35rem; }
.lang-switch a, .lang-switch button, .lang-switch .lang-btn {
  padding: .25rem .6rem;
  border: 1px solid var(--border-subtle);
  border-radius: .3rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--chip-bg);
  font-family: inherit;
  line-height: normal;
  transition: all .2s;
}
.lang-switch a.active, .lang-switch button.active, .lang-switch .lang-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* Theme Toggle Button */
.theme-toggle-btn, .theme-toggle {
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  border-radius: .35rem;
  padding: .25rem .55rem;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  line-height: 1;
  color: var(--text-main);
  font-family: inherit;
}
.theme-toggle-btn:hover, .theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}
.theme-icon-sun { display: inline-block; }
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline-block; }

.site-header nav > ul, .site-header .site-nav { display: flex; align-items: center; gap: 1.1rem; list-style: none; margin: 0; padding: 0; }
.site-header nav a, .site-header .site-nav a { color: var(--text-muted); text-decoration: none; font-size: .95rem; transition: color .2s; }
.site-header nav a:hover, .site-header nav a.active, .site-header .site-nav a:hover, .site-header .site-nav a.active { color: var(--accent); font-weight: 700; }

/* Hero Section - Compact & High-Value 2-Column Layout */
.hero {
  padding: 2.2rem 0 1.8rem;
  background: var(--bg-hero);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}
.hero .container {
  max-width: 1280px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 2.2rem;
  align-items: center;
}
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
  .hero {
    padding: 1.8rem 0 1.5rem;
  }
}

/* Hero Badge */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 0.75rem;
}
.hero-badge .badge-icon {
  font-size: 0.95rem;
}

/* Hero Typography */
.hero-content h1 {
  font-size: 1.95rem;
  line-height: 1.25;
  margin-bottom: 0.55rem;
  color: var(--text-main);
  font-weight: 800;
}
.hero-content p {
  max-width: 640px;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  font-size: 0.98rem;
  line-height: 1.55;
}

/* Hero Search Box */
.hero-search-form {
  margin-bottom: 1.1rem;
}
.hero-search-wrap {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: 0.6rem;
  padding: 0.3rem 0.35rem 0.3rem 0.9rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transition: border-color 0.2s, box-shadow 0.2s;
}
html[dir="rtl"] .hero-search-wrap,
[dir="rtl"] .hero-search-wrap {
  padding: 0.3rem 0.9rem 0.3rem 0.35rem;
}
.hero-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}
.hero-search-icon {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-inline-end: 0.6rem;
}
.hero-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  padding: 0.5rem 0;
  font-family: inherit;
}
.hero-search-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 0.45rem;
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}
.hero-search-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Quick Filter Tags & Format Chips */
.hero-quick-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.82rem;
}
.quick-tags-label {
  color: var(--text-faint);
  font-weight: 600;
  margin-inline-end: 0.3rem;
}
.hero-chip {
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  text-decoration: none;
  padding: 0.22rem 0.6rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}
.hero-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hero-format-pill {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #eab308;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.18rem 0.48rem;
  border-radius: 0.3rem;
  letter-spacing: 0.03em;
}

/* Column 2: Stats & Trust Card Showcase */
.hero-stats-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.85rem;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.hero-stats-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.stats-badge-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}
.stats-header-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.hero-stat-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 0.55rem;
  padding: 0.75rem 0.85rem;
  transition: transform 0.2s, border-color 0.2s;
}
.hero-stat-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.stat-number {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  font-weight: 500;
}
.hero-stats-footer {
  text-align: center;
}
.hero-explore-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.65rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}
.hero-explore-btn:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.btn { display: inline-block; padding: .75rem 1.4rem; background: var(--accent); color: var(--accent-text); border-radius: .35rem; text-decoration: none; font-weight: 700; transition: all .2s ease; }
.btn.small { padding: .45rem .9rem; font-size: .85rem; }
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* Ad placeholder */
.ad-placeholder { background: var(--bg-subtle); border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); padding: 1.2rem 0; }
.ad-label { color: var(--text-faint); font-size: .85rem; text-align: center; }

/* Featured / Cards */
.featured { padding: 4rem 0; }
.featured h2 { font-size: 1.6rem; margin-bottom: 1.5rem; color: var(--text-main); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; }
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: .6rem; padding: 1.4rem; box-shadow: var(--card-shadow); transition: transform .2s, border-color .2s; }
.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card h3 { font-size: 1.1rem; margin-bottom: .3rem; color: var(--text-main); }
.card p { color: var(--text-muted); font-size: .95rem; margin-bottom: 1rem; }

/* Card Gallery */
.card-image { width: 100%; aspect-ratio: 1 / 1; max-height: 260px; overflow: hidden; border-radius: .5rem; margin-bottom: .75rem; background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; }
.card-image img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s ease; }
.card-image img:hover { transform: scale(1.05); }
.card-thumbnails { display: flex; gap: .4rem; margin-bottom: .75rem; }
.card-thumbnails img { width: 60px; height: 60px; object-fit: cover; border-radius: .3rem; cursor: pointer; border: 1px solid var(--border-subtle); transition: border-color .2s; }
.card-thumbnails img:hover { border-color: var(--accent); }

/* Card Meta Tags */
.card-meta { display: flex; gap: .4rem; margin-bottom: .6rem; flex-wrap: wrap; }
.card-cat-badge { font-size: .72rem; padding: .2rem .55rem; border-radius: .3rem; background: var(--chip-bg); color: var(--accent); border: 1px solid var(--border-subtle); text-decoration: none; font-weight: 600; }
.card-cat-badge:hover { border-color: var(--accent); }

/* Info section */
.info { padding: 3rem 0; background: var(--bg-subtle); }
.info h2 { font-size: 1.3rem; margin-bottom: 1rem; color: var(--text-main); }
.info ul { list-style: disc; padding-right: 1.4rem; }
html[lang="en"] .info ul { padding-left: 1.4rem; padding-right: 0; }
.info li { margin-bottom: .5rem; color: var(--text-body); }

/* Footer */
.site-footer { background: var(--footer-bg); border-top: 1px solid var(--border-color); padding: 1.5rem 0; }
.site-footer p { text-align: center; color: var(--text-faint); font-size: .85rem; }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* Forms */
form label { display: block; margin-top: 1rem; margin-bottom: .25rem; font-weight: 600; color: var(--text-main); }
form input, form textarea { width: 100%; padding: .6rem .75rem; border-radius: .35rem; border: 1px solid var(--border-subtle); background: var(--search-bg); color: var(--text-main); font-size: 1rem; }
form button { margin-top: 1.2rem; }

/* Responsive */
@media (max-width: 640px) {
  .site-header .container { flex-direction: column; gap: .6rem; align-items: flex-start; }
  .hero h1 { font-size: 1.6rem; }
  .cards { grid-template-columns: 1fr; }
}

/* =========================================
   Product Details Page & Download Countdown
   ========================================= */
.product-hero { padding: 3rem 0; background: var(--bg-subtle); border-bottom: 1px solid var(--border-color); }
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 850px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* Gallery */
.product-gallery { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: .8rem; padding: 1.2rem; }
.gallery-main { width: 100%; height: 420px; border-radius: .5rem; overflow: hidden; margin-bottom: 1rem; background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s ease; }
.gallery-thumbs { display: flex; gap: .7rem; flex-wrap: wrap; }
.gallery-thumbs img { width: 75px; height: 75px; object-fit: cover; border-radius: .4rem; border: 2px solid var(--border-subtle); cursor: pointer; transition: all .2s; }
.gallery-thumbs img:hover, .gallery-thumbs img.active { border-color: var(--accent); transform: scale(1.05); }

/* Product Info */
.product-info h1 { font-size: 1.8rem; line-height: 1.3; color: var(--text-main); margin-bottom: .8rem; }
.specs-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 9999px; font-size: .8rem; font-weight: 700; background: var(--chip-bg); color: var(--accent); border: 1px solid var(--border-subtle); }
.badge.green { color: #16a34a; border-color: #86efac; background: #f0fdf4; }
.badge.gold { color: #d97706; border-color: #fde68a; background: #fffbeb; }
[data-theme="dark"] .badge.green { color: #4ade80; border-color: #15803d; background: #052e16; }
[data-theme="dark"] .badge.gold { color: #f59e0b; border-color: #b45309; background: #451a03; }

/* Download Box & 3s Timer */
.download-box { background: var(--download-box-bg); border: 2px solid var(--accent); border-radius: .8rem; padding: 1.8rem; margin: 1.5rem 0; text-align: center; box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.15); }
.download-box h3 { font-size: 1.25rem; color: var(--text-main); margin-bottom: .5rem; }
.download-box p { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.2rem; }
.download-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 1rem 1.5rem; background: var(--accent); color: var(--accent-text); font-size: 1.1rem; font-weight: 800; border: none; border-radius: .5rem; cursor: pointer; transition: all .2s; text-decoration: none; }
.download-btn:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4); }
.download-btn:disabled { background: var(--border-subtle); color: var(--text-faint); cursor: not-allowed; transform: none; box-shadow: none; }

.countdown-bar-wrapper { width: 100%; height: 6px; background: var(--border-subtle); border-radius: 3px; overflow: hidden; margin-top: 1rem; display: none; }
.countdown-bar { width: 0%; height: 100%; background: var(--accent); transition: width 3s linear; }

/* Product Article Section */
.product-article { padding: 4rem 0; background: var(--bg-body); }
.article-content { max-width: 940px; margin: 0 auto; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 1rem; padding: 2.5rem; box-shadow: var(--card-shadow); }
.article-content h2 { font-size: 1.45rem; color: var(--accent); margin: 2.2rem 0 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: .6rem; display: flex; align-items: center; gap: .5rem; }
.article-content h2:first-of-type { margin-top: 0; }
.article-content h3 { font-size: 1.15rem; color: var(--text-main); margin: 1.5rem 0 .6rem; font-weight: 700; }
.article-content p { color: var(--text-body); font-size: 1.02rem; line-height: 1.85; margin-bottom: 1.25rem; }
.article-content ul { list-style: disc; margin: 1rem 1.5rem 1.5rem; color: var(--text-body); }
.article-content li { margin-bottom: .6rem; line-height: 1.7; }
.specs-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0 2rem; border-radius: .5rem; overflow: hidden; }
.specs-table th, .specs-table td { padding: .85rem 1.1rem; text-align: start; border: 1px solid var(--border-color); font-size: .92rem; }
.specs-table th { background: var(--table-th-bg); color: var(--accent); font-weight: 700; width: 32%; }
.specs-table td { background: var(--table-td-bg); color: var(--text-main); }

/* Article Callouts & Monetization Boxes */
.pro-callout { background: var(--bg-subtle); border-inline-start: 4px solid var(--accent); border-radius: .5rem; padding: 1.2rem 1.4rem; margin: 1.5rem 0; }
.pro-callout.profit { border-inline-start-color: #16a34a; background: rgba(22, 163, 74, 0.08); }
.pro-callout h4 { font-size: 1rem; color: var(--text-main); margin-bottom: .4rem; display: flex; align-items: center; gap: .4rem; font-weight: 700; }
.pro-callout p { margin-bottom: 0 !important; font-size: .92rem; color: var(--text-muted); line-height: 1.7; }

/* Fabrication Step Cards */
.step-list { list-style: none !important; padding: 0 !important; margin: 1.5rem 0 !important; display: flex; flex-direction: column; gap: 1rem; }
.step-item { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: .6rem; padding: 1.2rem 1.4rem; }
.step-header { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.step-num { background: var(--accent); color: var(--accent-text); font-weight: 900; font-size: .8rem; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-title { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.step-item p { margin-bottom: 0 !important; font-size: .92rem; color: var(--text-body); }

/* FAQ Accordion/Items */
.faq-box { margin: 1.5rem 0; display: flex; flex-direction: column; gap: .85rem; }
.faq-item { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: .5rem; padding: 1rem 1.25rem; }
.faq-q { font-weight: 700; font-size: .95rem; color: var(--accent); margin-bottom: .35rem; }
.faq-a { font-size: .9rem; color: var(--text-body); margin-bottom: 0 !important; line-height: 1.7; }

/* Breadcrumb Navigation */
.breadcrumb, .breadcrumbs { background: var(--bg-header); border-bottom: 1px solid var(--border-color); padding: .85rem 0; font-size: .88rem; }
.breadcrumb .container, .breadcrumbs .container { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.breadcrumb a, .breadcrumbs a { color: var(--text-muted); text-decoration: none; transition: color .2s; }
.breadcrumb a:hover, .breadcrumbs a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-faint); font-size: .75rem; margin: 0 .15rem; }
.breadcrumb .current { color: var(--accent); font-weight: 600; }

/* Breadcrumbs with ol/li list support */
.breadcrumbs .breadcrumb-list, ol.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: .4rem;
}
.breadcrumbs .breadcrumb-list li, ol.breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: .88rem;
}
.breadcrumbs .breadcrumb-list li:not(:last-child)::after, ol.breadcrumb-list li:not(:last-child)::after {
  content: "/";
  margin: 0 .45rem;
  color: var(--text-faint);
  font-size: .75rem;
}
.breadcrumbs .breadcrumb-list li.active, .breadcrumbs .breadcrumb-list li[aria-current="page"], ol.breadcrumb-list li.active {
  color: var(--accent);
  font-weight: 600;
}

/* =========================================
   Container Fluid & Wide Layout
   ========================================= */
.container-fluid {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .6rem;
  padding-top: .9rem;
  padding-bottom: .9rem;
}
.breadcrumb-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

/* =========================================
   Amazon-Style Two-Column Catalog Layout
   ========================================= */
.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
  align-items: start;
}

/* Amazon Sidebar */
.catalog-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: .85rem;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  box-shadow: var(--card-shadow);
  transition: background-color .3s, border-color .3s;
}

.catalog-sidebar::-webkit-scrollbar {
  width: 5px;
}
.catalog-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.sidebar-header {
  padding-bottom: .85rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .6rem;
}

.sidebar-title-row h3 {
  font-size: 1rem;
  color: var(--text-main);
  margin: 0;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.sidebar-close-btn {
  display: none;
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  border-radius: .3rem;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: .2rem .5rem;
  line-height: 1;
}
.sidebar-close-btn:hover {
  color: var(--text-main);
  border-color: var(--accent);
}

.clear-filters-btn {
  width: 100%;
  padding: .45rem .75rem;
  font-size: .8rem;
  border-radius: .4rem;
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
  font-weight: 600;
  text-align: center;
}
.clear-filters-btn:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.filter-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-color);
}
.filter-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.filter-section h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .7rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* Department Tree */
.dept-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dept-item {
  margin-bottom: .25rem;
  cursor: pointer;
  border-radius: .4rem;
}

.dept-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem .6rem;
  border-radius: .4rem;
  color: var(--text-body);
  font-size: .88rem;
  transition: all .15s ease;
}

.dept-item:hover > .dept-row {
  background: var(--chip-bg);
  color: var(--text-main);
}

.dept-item.active > .dept-row {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  font-weight: 700;
}

.dept-name {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.dept-bullet {
  font-size: 1rem;
}

.count-badge {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--counter-bg);
  padding: .1rem .45rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

.subdept-list {
  list-style: none;
  padding-inline-start: 1.3rem;
  margin: .25rem 0 .4rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  border-inline-start: 1.5px solid var(--border-subtle);
}

.subdept-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .3rem .55rem;
  border-radius: .3rem;
  font-size: .82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s ease;
}

.subdept-item:hover {
  color: var(--accent);
  background: var(--chip-bg);
}

.subdept-item.active {
  color: var(--accent);
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
}

.count-sub {
  font-size: .72rem;
  opacity: .8;
}

/* Facet Checkboxes */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .84rem;
  color: var(--text-body);
  cursor: pointer;
  user-select: none;
  padding: .15rem 0;
}

.custom-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--border-subtle);
  border-radius: .25rem;
  background: var(--search-bg);
  cursor: pointer;
  display: grid;
  place-content: center;
  margin: 0;
  transition: all .2s;
  flex-shrink: 0;
}

.custom-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.custom-checkbox input[type="checkbox"]:checked::before {
  content: "✓";
  color: var(--accent-text);
  font-size: .75rem;
  font-weight: 900;
}

.custom-checkbox:hover .label-text {
  color: var(--text-main);
}

/* Catalog Main & Top Bar */
.catalog-main {
  min-width: 0;
}

.catalog-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .85rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: .75rem;
  padding: .85rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--card-shadow);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.dept-breadcrumb {
  font-size: .92rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.breadcrumb-prefix {
  color: var(--text-faint);
  font-size: .85rem;
}

.active-dept-label {
  color: var(--text-main);
  font-size: 1.05rem;
}

.results-badge {
  font-size: .85rem;
  color: var(--accent);
  font-weight: 600;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.catalog-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}

.catalog-search-box .search-icon {
  position: absolute;
  inset-inline-start: .85rem;
  color: var(--text-faint);
  font-size: .9rem;
  pointer-events: none;
}

.catalog-search-box input {
  width: 100%;
  padding: .55rem 2rem .55rem 2.4rem;
  font-size: .9rem;
  background: var(--search-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  color: var(--text-main);
  transition: all .2s;
}

html[lang="ar"] .catalog-search-box input {
  padding: .55rem 2.4rem .55rem 2rem;
}

.catalog-search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.search-clear-btn {
  position: absolute;
  inset-inline-end: .75rem;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: .85rem;
  padding: .2rem;
}
.search-clear-btn:hover {
  color: var(--text-main);
}

.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: .4rem;
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: .5rem .85rem;
  border-radius: .4rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.mobile-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Active Filter Chips */
.active-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1.25rem;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .65rem;
  background: var(--chip-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: .8rem;
  color: var(--text-main);
}

.active-chip-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: bold;
}
.active-chip-remove:hover {
  color: #ef4444;
}

/* =========================================
   Modern E-Commerce Product Card Design
   ========================================= */
.catalog-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
  gap: 1.25rem !important;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: .85rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 24px -6px rgba(2, 132, 199, 0.2);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-subtle);
  display: block;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.product-card:hover .card-image-wrap img {
  transform: scale(1.06);
}

.card-overlay-badges {
  position: absolute;
  top: .6rem;
  inset-inline: .6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.badge-thickness {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #38bdf8;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: .3rem;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-free {
  background: #16a34a;
  color: #ffffff;
  font-size: .68rem;
  font-weight: 800;
  padding: .2rem .55rem;
  border-radius: .3rem;
  letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.4);
}

.card-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-cat-hierarchy {
  font-size: .75rem;
  color: var(--accent);
  margin-bottom: .4rem;
  font-weight: 600;
}

.card-title {
  font-size: .95rem !important;
  line-height: 1.4 !important;
  font-weight: 700 !important;
  margin-bottom: .6rem !important;
  flex-grow: 1;
}

.card-title a {
  color: var(--text-main);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .2s ease;
}

.card-title a:hover {
  color: var(--accent);
}

.card-formats-row {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}

.format-pill {
  font-size: .68rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: .25rem;
  background: var(--chip-bg);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.card-footer-action {
  margin-top: auto;
}

.btn-card-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  padding: .55rem .8rem;
  font-size: .84rem;
  font-weight: 700;
  border-radius: .4rem;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  transition: all .2s ease;
}

.btn-card-download:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.35);
}

/* No Results Message */
.no-results-msg {
  background: var(--card-bg);
  border: 1px dashed var(--border-subtle);
  border-radius: .8rem;
  padding: 3rem 1.5rem;
  text-align: center;
  margin: 1.5rem 0;
}

.no-results-msg .icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: .8rem;
}

.no-results-msg h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: .4rem;
}

.no-results-msg p {
  color: var(--text-muted);
  font-size: .95rem;
  max-width: 480px;
  margin: 0 auto 1.25rem;
}

/* Responsive Drawer for Mobile */
@media (max-width: 900px) {
  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding-top: 1rem;
  }

  .mobile-filter-btn {
    display: inline-flex;
  }

  .catalog-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: auto;
    inset-inline-end: 0;
    width: 310px;
    max-width: 85vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    z-index: 1050;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.4);
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  html[dir="rtl"] .catalog-sidebar {
    transform: translateX(105%);
  }

  .catalog-sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-close-btn {
    display: block;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1040;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .catalog-search-box {
    min-width: 170px;
    flex-grow: 1;
  }
}

/* Homepage Category Showcase Grid */
.category-showcase { padding: 3.5rem 0 2rem; background: var(--bg-subtle); border-bottom: 1px solid var(--border-color); }
.category-showcase h2 { text-align: center; font-size: 1.85rem; color: var(--text-main); margin-bottom: .5rem; }
.category-showcase p.sub { text-align: center; color: var(--text-muted); font-size: .95rem; margin-bottom: 2.2rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.cat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all .25s ease;
  text-decoration: none;
  box-shadow: var(--card-shadow);
}
.cat-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 10px 25px -5px rgba(2, 132, 199, 0.15); }
.cat-card-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: .85rem;
  background: var(--chip-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.cat-card-info h3 { font-size: 1.15rem; color: var(--text-main); margin-bottom: .2rem; font-weight: 700; }
.cat-card-info span.en-subtitle { font-size: .8rem; color: var(--text-muted); display: block; }
.cat-card-subcats { display: flex; flex-wrap: wrap; gap: .4rem; margin: .85rem 0 1.25rem; flex-grow: 1; }
.cat-subcat-pill { font-size: .75rem; padding: .2rem .6rem; border-radius: 9999px; background: var(--chip-bg); color: var(--text-body); border: 1px solid var(--border-subtle); }
.cat-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: .85rem; }
.cat-card-count { color: var(--accent); font-weight: 700; }
.cat-card-link-text { color: var(--text-muted); display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.cat-card:hover .cat-card-link-text { color: var(--accent); }

/* =========================================
   Related Products Section
   ========================================= */
.related-section,
.related-products {
  padding: 4rem 0;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
}

.related-section h2,
.related-products h2 {
  font-size: 1.6rem;
  color: var(--text-main);
  margin-bottom: .4rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: .95rem;
  margin-bottom: 2rem;
}

/* Related Products Grid - Responsive 4 Column layout for normal compact cards */
.related-section .cards,
.related-products .cards,
.related-section .grid,
.related-products .grid,
.related-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 1.25rem !important;
}

@media (max-width: 1100px) {
  .related-section .cards,
  .related-products .cards,
  .related-section .grid,
  .related-products .grid,
  .related-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .related-section .cards,
  .related-products .cards,
  .related-section .grid,
  .related-products .grid,
  .related-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }
}

@media (max-width: 480px) {
  .related-section .cards,
  .related-products .cards,
  .related-section .grid,
  .related-products .grid,
  .related-grid {
    grid-template-columns: 1fr !important;
  }
}

.related-footer-cta {
  text-align: center;
  margin-top: 2.5rem;
}

.btn.outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: .4rem;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s ease;
}

.btn.outline:hover {
  background: var(--accent);
  color: var(--accent-text);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

/* =========================================
   Back to Top Floating Button
   ========================================= */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  inset-inline-end: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease, background-color .2s ease;
  z-index: 999;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.back-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.35);
}
.back-to-top:active {
  transform: translateY(-1px) scale(0.98);
}
.back-to-top svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent-text);
  stroke-width: 2.5;
  transition: transform .2s ease;
}
.back-to-top:hover svg {
  transform: translateY(-2px);
}
@media (max-width: 640px) {
  .back-to-top {
    bottom: 1.25rem;
    inset-inline-end: 1.25rem;
    width: 42px;
    height: 42px;
  }
}
