/* StockDivar V74.4 — shared date treatment and unified cards across saved, store and panel */
:root {
  --v744-surface: var(--color-surface, var(--surface, #fff));
  --v744-soft: var(--color-surface-muted, var(--surface-2, #f8fafc));
  --v744-line: var(--color-border, var(--line, #e5e7eb));
  --v744-text: var(--color-text, var(--text, #111827));
  --v744-muted: var(--color-text-muted, var(--muted, #6b7280));
  --v744-brand: var(--color-primary, var(--red-700, #a71928));
  --v744-success: #16805c;
}

/* Exact date: relative value stays scannable and full Persian date remains visible. */
.listing-date {
  display: inline-grid !important;
  gap: 1px;
  min-width: 0;
  color: var(--v744-muted);
  line-height: 1.35;
  vertical-align: middle;
}
.listing-date__relative {
  color: var(--v744-muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}
.listing-date__full {
  color: color-mix(in srgb, var(--v744-muted) 82%, transparent);
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}
.market-card-meta .listing-date {
  flex: 1 0 100%;
  padding-top: 3px;
  border-top: 1px dashed color-mix(in srgb, var(--v744-line) 82%, transparent);
}
.market-card-meta .listing-date__relative { color: var(--v744-text); }
.market-card-meta .listing-date__full { font-size: 10px; }

/* Shared visual fallback used outside category/search pages. */
.unified-card-illustration {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg,#dcefed,#f6d9de);
}
.unified-card-illustration::before,
.unified-card-illustration::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,.35);
}
.unified-card-illustration::before { width: 190px; height: 190px; right: -45px; top: -45px; }
.unified-card-illustration::after { width: 135px; height: 135px; left: -34px; bottom: -34px; }
.unified-card-illustration__plate {
  position: absolute;
  width: 74%;
  height: 66%;
  inset: 17% 13%;
  border-radius: 28px;
  background: rgba(255,255,255,.72);
  transform: rotate(-5deg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 18px 38px rgba(55,65,81,.06);
}
.unified-card-illustration__icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #263243;
  font-size: clamp(36px,5vw,64px);
}
.unified-card-illustration--digital { background: linear-gradient(135deg,#e2e9ff,#f6dde8); }
.unified-card-illustration--tools { background: linear-gradient(135deg,#dcefed,#f6d9de); }
.unified-card-illustration--home { background: linear-gradient(135deg,#e7f4ea,#e4edf9); }
.unified-card-illustration--cars { background: linear-gradient(135deg,#e6edf5,#f7e2e2); }
.unified-card-illustration--estate { background: linear-gradient(135deg,#e6f3f0,#f0e6ff); }
.unified-card-illustration--personal { background: linear-gradient(135deg,#fde8ef,#f5edf7); }
.unified-card-illustration--art { background: linear-gradient(135deg,#f6ece1,#e4f0ff); }
.unified-card-illustration--food { background: linear-gradient(135deg,#fef3d8,#fce4dd); }
.unified-card-illustration--store { background: linear-gradient(135deg,#e0eef2,#f4e3ed); }
.unified-card-illustration--job { background: linear-gradient(135deg,#e8eff9,#f8e5dc); }

/* Saved items */
.saved-grid {
  grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  align-items: stretch;
}
.saved-ad-card.market-ad-card {
  display: block !important;
  padding: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.saved-ad-card .market-card-link { pointer-events: auto; }
.saved-ad-card .saved-card-body.market-card-body {
  min-height: 220px !important;
  grid-template-rows: auto auto auto 1fr auto !important;
}
.saved-ad-card .saved-card-remove {
  left: 10px !important;
  top: 10px !important;
  color: var(--v744-brand) !important;
  font-size: 18px !important;
}
.saved-ad-card .market-card-description { min-height: 0; }
.saved-ad-card .saved-card-actions-unified {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--v744-line);
}
.saved-ad-card .saved-card-actions-unified .primary-btn {
  min-height: 38px;
  padding-inline: 13px;
  font-size: 11px;
}
.saved-price-note {
  color: var(--v744-success);
  font-size: 10.5px;
  font-weight: 800;
}

/* Storefront shell */
.storefront-hero-v744 {
  padding: 30px 0 26px;
  background: linear-gradient(145deg,#111827,#38171f);
  color: #fff;
}
.storefront-breadcrumb { display:flex; gap:7px; align-items:center; margin-bottom:18px; color:#d4d9e2; font-size:12px; }
.storefront-banner {
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  gap:20px;
  align-items:center;
}
.storefront-logo {
  width:92px;
  height:92px;
  border-radius:26px;
  background:#fff;
  display:grid;
  place-items:center;
  overflow:hidden;
  color:var(--v744-brand);
  font-size:36px;
  font-weight:950;
}
.storefront-logo img { width:100%; height:100%; object-fit:cover; }
.storefront-title h1 { margin:0 0 6px; font-size:clamp(25px,3vw,38px); }
.storefront-title p { margin:0; color:#d8dee9; }
.storefront-actions { display:flex; gap:9px; flex-wrap:wrap; }
.storefront-actions button { min-height:44px; }
.storefront-actions .secondary-btn { background:#fff; }
.storefront-actions .saved { background:#fff3f5; color:#8f1722; }
.storefront-stats {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin-top:22px;
}
.storefront-stats div {
  padding:14px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:16px;
  background:rgba(255,255,255,.07);
  backdrop-filter:blur(8px);
}
.storefront-stats strong { display:block; font-size:18px; }
.storefront-stats span { color:#d7dce5; font-size:12px; }
.storefront-main {
  display:grid;
  grid-template-columns:minmax(0,1fr) 300px;
  gap:22px;
  padding-block:28px 60px;
}
.storefront-panel {
  padding:20px;
  border:1px solid var(--v744-line);
  border-radius:22px;
  background:var(--v744-surface);
}
.storefront-panel + .storefront-panel { margin-top:16px; }
.storefront-panel-head {
  display:flex;
  justify-content:space-between;
  align-items:end;
  gap:14px;
  margin-bottom:16px;
}
.storefront-panel-head h2 { margin:2px 0 0; font-size:22px; }
.store-product-search {
  width:min(290px,100%);
  min-height:44px;
  padding:0 12px;
  border:1px solid var(--v744-line);
  border-radius:13px;
  background:var(--v744-soft);
  color:var(--v744-text);
  font:inherit;
}
.storefront-products {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.store-product-card.market-ad-card { display:block !important; min-height:0 !important; padding:0 !important; }
.store-product-card .market-card-body { min-height:210px !important; }
.storefront-side { min-width:0; }
.storefront-contact { display:grid; gap:9px; }
.storefront-contact > * { width:100%; text-align:center; }
.store-rating-card { text-align:center; }
.store-rating-card > strong { display:block; font-size:40px; }
.store-rating-card p { color:var(--v744-muted); }
.store-tags { display:flex; flex-wrap:wrap; gap:7px; }
.store-tags span { padding:5px 9px; border-radius:999px; background:var(--v744-soft); color:var(--v744-muted); font-size:11px; }
.store-policy-list { display:grid; gap:10px; padding:0; margin:0; list-style:none; }
.store-policy-list li { display:flex; gap:9px; align-items:flex-start; }
.store-policy-list li::before { content:"✓"; display:grid; place-items:center; flex:0 0 23px; height:23px; border-radius:50%; background:#e9f8f1; color:#16805c; font-weight:900; }
.store-empty { padding:42px 18px; border:1px dashed var(--v744-line); border-radius:18px; text-align:center; color:var(--v744-muted); }

/* User panel highlighted products */
.product-cards-grid {
  grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  align-items:stretch;
}
.panel-listing-card.market-ad-card { display:block !important; padding:0 !important; min-height:0 !important; }
.panel-listing-card .market-card-body {
  min-height:208px !important;
  grid-template-rows:auto auto auto 1fr auto !important;
}
.panel-listing-card .panel-card-actions {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding-top:10px;
  border-top:1px solid var(--v744-line);
}
.panel-listing-card .panel-card-actions button,
.panel-listing-card .panel-card-actions a {
  min-height:36px;
  padding:0 11px;
  border-radius:10px;
  font-size:10.5px;
}
.panel-table-date .listing-date__relative { color:var(--v744-text); }
.panel-table-date .listing-date__full { display:block; }
.managed-date-detail { display:grid; gap:2px; }
.managed-date-detail small { color:var(--v744-muted); }

html[data-theme="dark"] .storefront-panel,
body.dark-mode .storefront-panel,
html[data-theme="dark"] .saved-ad-card,
body.dark-mode .saved-ad-card,
html[data-theme="dark"] .panel-listing-card,
body.dark-mode .panel-listing-card {
  --v744-surface:#121a2a;
  --v744-soft:#1a2538;
  --v744-line:#2b374b;
  --v744-text:#f4f6fb;
  --v744-muted:#aeb7c8;
}

@media(max-width:1080px) {
  .product-cards-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .storefront-main { grid-template-columns:1fr; }
  .storefront-side { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  .storefront-panel + .storefront-panel { margin-top:0; }
}
@media(max-width:760px) {
  .listing-date__relative { font-size:9.5px; }
  .listing-date__full { font-size:8.5px; }
  .saved-grid,
  .storefront-products,
  .product-cards-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:9px !important; }
  .saved-ad-card .saved-card-body.market-card-body,
  .store-product-card .market-card-body,
  .panel-listing-card .market-card-body { min-height:190px !important; }
  .storefront-banner { grid-template-columns:auto 1fr; }
  .storefront-actions { grid-column:1/-1; }
  .storefront-actions > * { flex:1; }
  .storefront-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .storefront-panel-head { display:grid; align-items:stretch; }
  .store-product-search { width:100%; }
  .storefront-side { grid-template-columns:1fr; }
  .saved-card-actions-unified,
  .panel-card-actions { display:grid !important; }
}
@media(max-width:390px) {
  .saved-grid,
  .storefront-products,
  .product-cards-grid { grid-template-columns:1fr !important; }
}

.market-card-date-meta {
  flex: 1 0 100% !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 5px !important;
  padding-top: 3px;
  border-top: 1px dashed color-mix(in srgb, var(--v744-line) 82%, transparent);
}
.market-card-date-meta > svg { margin-top: 2px; }
.market-card-date-meta .listing-date { border-top: 0; padding-top: 0; }
@media(max-width:700px) {
  .market-card-meta .market-card-date-meta {
    display: flex !important;
    grid-column: 1 / -1;
  }
  .market-card-meta .market-card-date-meta .listing-date__full { display: block !important; }
}
