/*
 * JO-Dealz - Desktop Categories page + compact desktop footer.
 * Loaded only by templates/desktop-categories.php (desktop UAs). Mobile never requests this file.
 * Logical properties (inline-start/end) are used throughout so Arabic RTL is native, not mirrored.
 */

.dc-page {
  --dc-bg: var(--color-bg, #f7f7f9);
  --dc-surface: #fff;
  --dc-field: #f8fafc;
  --dc-text: #0f172a;
  --dc-muted: #64748b;
  --dc-border: #e5e7eb;
  --dc-brand: var(--color-primary, #f52a3b);
  --dc-brand-hover: var(--color-primary-hover, #b50045);
  --dc-brand-soft: rgba(var(--color-primary-rgb, 245, 42, 59), 0.08);
  --dc-radius: 14px;
  --dc-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, 0.04));
  --dc-shadow-hover: var(--shadow-md, 0 8px 24px -6px rgba(15, 23, 42, 0.12));
  background: var(--dc-bg);
  color: var(--dc-text);
  padding-block: 24px 64px;
}
.dark .dc-page {
  --dc-bg: #0b0f19; --dc-surface: #111827; --dc-field: #0f172a; --dc-text: #f1f5f9;
  --dc-muted: #94a3b8; --dc-border: #1f2937;
}
.dc-page [hidden] { display: none !important; }
.dc-page *, .dc-page *::before, .dc-page *::after { box-sizing: border-box; }
.dc-wrap { max-width: 1560px; margin-inline: auto; padding-inline: clamp(16px, 2.5vw, 40px); }
.dc-page .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Title ---------- */
.dc-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dc-title { margin: 0; font-size: clamp(24px, 2vw, 30px); font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; }
.dc-subtitle { margin: 4px 0 0; font-size: 14px; color: var(--dc-muted); }

/* ---------- Toolbar ---------- */
.dc-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(130px, 1fr) minmax(190px, 1.5fr) minmax(210px, 1.3fr) minmax(150px, 1fr) auto;
  gap: 10px;
  padding: 12px;
  background: var(--dc-surface);
  border: 1px solid var(--dc-border);
  border-radius: var(--dc-radius);
  box-shadow: var(--dc-shadow);
}
.dc-field {
  position: relative; display: flex; align-items: center; min-width: 0; height: 44px;
  background: var(--dc-field); border: 1px solid var(--dc-border); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.dc-field:hover { border-color: #cbd5e1; }
.dc-field:focus-within { border-color: var(--dc-brand); background: var(--dc-surface); box-shadow: var(--shadow-glow, 0 0 0 4px rgba(245, 42, 59, 0.12)); }
.dc-field-icon { position: absolute; inset-inline-start: 13px; font-size: 13px; color: var(--dc-muted); pointer-events: none; }
.dc-field-chevron { position: absolute; inset-inline-end: 13px; font-size: 10px; color: var(--dc-muted); pointer-events: none; }
.dc-input {
  width: 100%; height: 100%; min-width: 0; margin: 0; padding-block: 0; padding-inline: 36px 12px;
  background: transparent; border: 0; outline: 0; color: var(--dc-text); font: inherit; font-size: 14px;
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
}
select.dc-input { padding-inline-end: 32px; cursor: pointer; }
.dc-input::placeholder { color: #94a3b8; opacity: 1; }
.dc-input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.dc-field--price { padding-inline-start: 36px; gap: 4px; padding-inline-end: 10px; }
.dc-field--price .dc-field-icon { inset-inline-start: 13px; }
.dc-input--num { padding: 0; text-align: center; -moz-appearance: textfield; flex: 1 1 0; width: 0; }
.dc-input--num::-webkit-outer-spin-button, .dc-input--num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dc-price-sep { color: var(--dc-muted); }
.dc-price-unit { font-size: 12px; color: var(--dc-muted); font-weight: 600; }
.dc-reset {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding-inline: 16px;
  border: 1px solid var(--dc-border); border-radius: 12px; background: var(--dc-surface); color: var(--dc-muted);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.dc-reset:disabled { opacity: .55; cursor: default; }
.dc-reset.is-active { color: var(--dc-brand); border-color: var(--dc-brand); background: var(--dc-brand-soft); }
.dc-reset.is-active:hover { background: var(--dc-brand); color: #fff; }
.dc-page :focus-visible { outline: 2px solid var(--dc-brand); outline-offset: 2px; }
.dc-field :focus-visible { outline: 0; }

/* ---------- Parent categories ---------- */
.dc-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.dc-cat {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px; min-height: 64px;
  background: var(--dc-surface); border: 1px solid var(--dc-border); border-radius: var(--dc-radius);
  color: inherit; text-decoration: none; box-shadow: var(--dc-shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.dc-cat:hover { transform: translateY(-1px); box-shadow: var(--dc-shadow-hover); border-color: #cbd5e1; }
.dc-cat.is-active { border-color: var(--dc-brand); background: var(--dc-brand-soft); box-shadow: 0 0 0 1px var(--dc-brand) inset; }
.dc-cat-ico {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--dc-brand-soft); color: var(--dc-brand); font-size: 18px; overflow: hidden;
}
.dc-cat-ico img { width: 32px; height: 32px; object-fit: contain; }
.dc-cat-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.dc-cat-name { font-size: 14px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc-cat.is-active .dc-cat-name { color: var(--dc-brand-hover); }
.dc-cat-count { font-size: 12px; color: var(--dc-muted); min-height: 16px; }

/* ---------- Subcategories ---------- */
.dc-subs { margin-top: 12px; padding: 12px 14px; background: var(--dc-surface); border: 1px solid var(--dc-border); border-radius: var(--dc-radius); }
.dc-subs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dc-subs-label { font-size: 13px; font-weight: 700; color: var(--dc-muted); }
.dc-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; background: none; border: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--dc-brand); cursor: pointer; }
.dc-link:hover { color: var(--dc-brand-hover); text-decoration: underline; }
.dc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding-inline: 14px;
  background: var(--dc-field); border: 1px solid var(--dc-border); border-radius: 999px;
  color: var(--dc-text); font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.dc-chip em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--dc-muted); }
.dc-chip em:empty { display: none; }
.dc-chip:hover { border-color: var(--dc-brand); color: var(--dc-brand); }
.dc-chip.is-empty { opacity: .6; }
.dc-chip.is-active { background: var(--dc-brand); border-color: var(--dc-brand); color: #fff; }
.dc-chip.is-active em { color: rgba(255, 255, 255, .85); }
.dc-chip--more { background: transparent; border-style: dashed; color: var(--dc-brand); }

/* ---------- Deals ---------- */
.dc-deals { margin-top: 28px; }
.dc-deals-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.dc-deals-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.dc-deals-count { padding: 4px 12px; border-radius: 999px; background: var(--dc-brand-soft); color: var(--dc-brand-hover); font-size: 13px; font-weight: 700; }
.dc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; align-items: stretch; }

.dc-deal {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--dc-surface); border: 1px solid var(--dc-border); border-radius: var(--dc-radius);
  box-shadow: var(--dc-shadow); transition: transform .18s, box-shadow .18s, border-color .18s; cursor: pointer;
}
.dc-deal:hover { transform: translateY(-3px); box-shadow: var(--dc-shadow-hover); border-color: #cbd5e1; }
.dc-deal-media { position: relative; aspect-ratio: 4 / 3; background: #e2e8f0; overflow: hidden; }
.dc-deal-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.dc-deal:hover .dc-deal-media img { transform: scale(1.04); }
.dc-badge {
  position: absolute; inset-block-start: 10px; inset-inline-start: 10px; z-index: 2; display: inline-flex; align-items: baseline; gap: 4px;
  padding: 4px 10px; border-radius: 999px; background: var(--gradient-primary, linear-gradient(135deg, #f52a3b, #b50045));
  color: #fff; font-size: 13px; font-weight: 800; line-height: 1.4; box-shadow: 0 2px 8px rgba(181, 0, 69, .3);
}
.dc-badge small { font-size: 10px; font-weight: 700; opacity: .9; }
.dc-tag {
  position: absolute; inset-block-end: 10px; inset-inline-start: 10px; z-index: 2; padding: 2px 9px; border-radius: 999px;
  background: rgba(15, 23, 42, .78); color: #fff; font-size: 11px; font-weight: 700; backdrop-filter: blur(4px);
}
.dc-fav {
  position: absolute; inset-block-start: 10px; inset-inline-end: 10px; z-index: 3; display: grid; place-items: center;
  width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: #475569;
  font-size: 15px; cursor: pointer; box-shadow: 0 2px 8px rgba(15, 23, 42, .18); transition: transform .15s, color .15s;
}
.dc-fav:hover { transform: scale(1.1); color: var(--dc-brand); }
.dc-fav.is-on { color: var(--dc-brand); }
.dc-deal-body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 14px; }
.dc-merchant { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--dc-muted); font-weight: 600; }
.dc-merchant-logo { flex: none; width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.dc-merchant-logo--letter { display: grid; place-items: center; background: var(--dc-brand-soft); color: var(--dc-brand); font-size: 11px; font-weight: 800; }
.dc-merchant-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-verified { flex: none; color: #3b82f6; font-size: 11px; }
.dc-deal-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.45; min-height: 2.9em; }
.dc-deal-title a {
  color: var(--dc-text); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dc-deal-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.dc-deal:hover .dc-deal-title a { color: var(--dc-brand-hover); }
.dc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; min-height: 18px; font-size: 12px; color: var(--dc-muted); }
.dc-meta i { opacity: .75; margin-inline-end: 3px; }
.dc-soon { color: var(--dc-brand); font-weight: 700; }
.dc-deal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--dc-border); }
.dc-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-height: 28px; }
.dc-price b { font-size: 18px; font-weight: 800; color: var(--dc-text); line-height: 1.2; }
.dc-price b small { font-size: 11px; font-weight: 700; color: var(--dc-muted); }
.dc-price s { font-size: 12px; color: #94a3b8; }
.dc-cta {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding-inline: 14px; border-radius: 10px;
  background: var(--dc-brand); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; transition: background .15s;
}
.dc-cta i { font-size: 11px; }
.dc-deal:hover .dc-cta { background: var(--dc-brand-hover); }

/* skeleton */
.dc-skel { background: var(--dc-surface); border: 1px solid var(--dc-border); border-radius: var(--dc-radius); overflow: hidden; }
.dc-skel-img { aspect-ratio: 4 / 3; }
.dc-skel-body { display: grid; gap: 10px; padding: 14px; }
.dc-skel-body i { display: block; height: 12px; border-radius: 6px; }
.dc-skel-body i.s { width: 55%; }
.dc-skel-img, .dc-skel-body i { background: linear-gradient(90deg, #eef1f5 25%, #f8fafc 50%, #eef1f5 75%); background-size: 200% 100%; animation: dc-shimmer 1.3s linear infinite; }
@keyframes dc-shimmer { to { background-position: -200% 0; } }

/* empty + error */
.dc-empty, .dc-error {
  max-width: 540px; margin: 8px auto 0; padding: 28px 24px; text-align: center;
  background: var(--dc-surface); border: 1px dashed #cbd5e1; border-radius: var(--dc-radius);
}
.dc-error { grid-column: 1 / -1; border-style: solid; }
.dc-empty-ico { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; background: var(--dc-brand-soft); color: var(--dc-brand); font-size: 20px; }
.dc-empty h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.dc-empty p, .dc-error p { margin: 0 0 16px; font-size: 14px; line-height: 1.7; color: var(--dc-muted); }
.dc-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dc-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding-inline: 18px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; border: 1px solid transparent; transition: all .15s;
}
.dc-btn--primary { background: var(--dc-brand); color: #fff; }
.dc-btn--primary:hover { background: var(--dc-brand-hover); }
.dc-btn--ghost { background: var(--dc-surface); border-color: var(--dc-border); color: var(--dc-text); }
.dc-btn--ghost:hover { border-color: var(--dc-brand); color: var(--dc-brand); }

/* category banner ad */
.dc-banner { position: relative; display: block; height: 120px; margin-bottom: 20px; border-radius: var(--dc-radius); overflow: hidden; background: #0f172a; color: #fff; text-decoration: none; }
.dc-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .7; }
.dc-banner-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(2, 6, 23, .85), rgba(2, 6, 23, .1)); }
.dc-banner-copy { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 16px 20px; }
.dc-banner-copy b { align-self: flex-start; padding: 1px 8px; border-radius: 4px; background: var(--dc-brand); font-size: 10px; letter-spacing: .04em; }
.dc-banner-copy strong { font-size: 17px; font-weight: 800; }
.dc-banner-copy u { font-size: 12px; opacity: .9; }

.dc-sentinel { height: 1px; }
.dc-top {
  position: fixed; inset-block-end: 24px; inset-inline-start: 24px; z-index: 40; display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: var(--dc-brand); color: #fff; cursor: pointer; box-shadow: var(--shadow-md, 0 8px 24px -6px rgba(15, 23, 42, .3));
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.dc-top.visible { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Responsive (desktop UAs at narrower windows) ---------- */
@media (max-width: 1279px) {
  .dc-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dc-field--search { grid-column: 1 / -1; }
  .dc-reset { grid-column: 3; }
}
@media (max-width: 1023px) {
  .dc-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dc-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dc-reset { grid-column: auto; }
}
@media (max-width: 767px) {
  .dc-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dc-toolbar { grid-template-columns: minmax(0, 1fr); }
  .dc-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .dc-page *, .dc-page *::before, .dc-page *::after { animation: none !important; transition: none !important; }
}

/* ---------- Compact desktop footer (footer.php, $footerCompact) ---------- */
.dc-footer { background: #0b1120; color: #94a3b8; border-top: 1px solid #1e293b; margin-top: auto; font-size: 14px; }
.dc-footer a { color: inherit; text-decoration: none; transition: color .15s; }
.dc-footer a:hover { color: #fff; }
.dc-footer-inner { max-width: 1560px; margin-inline: auto; padding: 36px clamp(16px, 2.5vw, 40px) 20px; }
.dc-footer-grid { display: grid; grid-template-columns: 1.7fr 1fr 1.2fr 1fr 1.3fr; gap: 32px; }
.dc-footer h3 { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: #fff; letter-spacing: .02em; }
.dc-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dc-footer-about { margin: 12px 0 14px; max-width: 340px; line-height: 1.7; font-size: 13px; }
.dc-footer-social { display: flex; gap: 8px; }
.dc-footer-social a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #111a2e; border: 1px solid #1e293b; font-size: 14px; }
.dc-footer-social a:hover { background: var(--color-primary, #f52a3b); border-color: var(--color-primary, #f52a3b); }
.dc-footer-apps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dc-footer-apps a { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding-inline: 12px; border-radius: 10px; background: #111a2e; border: 1px solid #1e293b; color: #e2e8f0; font-size: 12px; font-weight: 600; }
.dc-footer-apps a:hover { border-color: var(--color-primary, #f52a3b); }
.dc-footer-contact li { display: flex; align-items: center; gap: 8px; }
.dc-footer-contact i { color: var(--color-primary, #f52a3b); width: 14px; text-align: center; }
.dc-footer-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 28px; padding-top: 16px; border-top: 1px solid #1e293b; font-size: 12px; }
.dc-footer-legal { display: flex; flex-wrap: wrap; gap: 6px 20px; }
@media (max-width: 1023px) { .dc-footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
