/* Hub marketplace: apps · store · ads · events */

.market-page {
  max-width: none !important;
  width: 100%;
  padding-inline: 0.75rem;
  margin: 0 auto 80px;
}

.market-hero {
  text-align: center;
  padding: 48px 12px 28px;
}

.market-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.2vw, 46px);
  font-weight: 900;
  color: #1d222b;
}

.market-hero p {
  margin: 0 auto 22px;
  max-width: 680px;
  color: #5f6672;
  font-size: 16px;
  line-height: 1.7;
  font-weight: 600;
}

.market-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.market-stat {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 14px;
  padding: 12px 20px;
  min-width: 110px;
  box-shadow: 0 4px 14px rgba(12, 14, 17, 0.06);
  text-align: center;
}

.market-stat strong {
  display: block;
  color: #d70000;
  font-size: 24px;
  font-weight: 900;
}

.market-stat span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #5f6672;
}

.market-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 8px 0 20px;
}

.market-tab {
  border: 1.5px solid rgba(215, 0, 0, 0.28);
  background: #fff;
  color: #d70000;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.market-tab.is-active,
.market-tab:hover {
  background: #d70000;
  color: #fff;
  border-color: #d70000;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.market-card {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(12, 14, 17, 0.07);
  border-top: 3px solid #d70000;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.market-card .card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff1f2f, #8a000c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.market-card .card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  margin: -2px 0 4px;
}

.market-card .card-media .card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.market-card .card-media .card-logo {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  z-index: 2;
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.market-card .badge-soft {
  display: inline-block;
  width: fit-content;
  background: rgba(215, 0, 0, 0.1);
  color: #d70000;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 10px;
}

.market-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #1d222b;
}

.market-card p {
  margin: 0;
  font-size: 12.5px;
  color: #5f6672;
  line-height: 1.6;
  flex: 1;
}

.market-card .price {
  color: #d70000;
  font-size: 20px;
  font-weight: 900;
  direction: ltr;
  unicode-bidi: isolate;
}

.market-card .meta {
  font-size: 12px;
  font-weight: 700;
  color: #667080;
}

.market-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.market-card .btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid rgba(215, 0, 0, 0.35);
  color: #d70000;
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

.market-card .btn-mini.primary,
.market-card .btn-mini:hover {
  background: #d70000;
  color: #fff;
  border-color: #d70000;
}

.ads-latest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.ads-item-card {
  border-radius: 18px;
  border: 1px solid #eceef5;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(12, 16, 24, 0.08);
}

.hub-ads-model {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

.hub-ads-model article {
  background: #fff;
  border: 1px solid #eceef5;
  border-radius: 16px;
  padding: 16px 14px;
  box-shadow: 0 8px 20px rgba(12, 16, 24, 0.05);
}

.hub-ads-model h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 900;
  color: #b91c1c;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-ads-model ul {
  margin: 0;
  padding: 0 16px 0 0;
  color: #374151;
  line-height: 1.8;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .hub-ads-model {
    grid-template-columns: 1fr;
  }
}

.ads-item-media {
  height: 140px;
  background: linear-gradient(135deg, #ff1f2f, #8a000c);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  font-weight: 800;
}

.ads-item-body {
  padding: 14px;
  text-align: center;
}

.ads-price {
  margin: 0 0 6px;
  color: #c2081c;
  font-size: 22px;
  font-weight: 900;
  direction: ltr;
  unicode-bidi: isolate;
}

.ads-item-title {
  margin: 0 0 8px;
  color: #141a23;
  font-size: 16px;
  font-weight: 900;
}

.ads-meta {
  margin: 0;
  color: #667080;
  font-size: 12px;
  font-weight: 700;
}

.home-market-strip {
  margin: 2rem 0;
}

.home-market-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.home-market-links a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  border-top: 3px solid #d70000;
  box-shadow: 0 8px 22px rgba(12, 14, 17, 0.07);
}

.home-market-links a strong {
  color: #1d222b;
  font-size: 15px;
}

.home-market-links a span {
  color: #5f6672;
  font-size: 13px;
  line-height: 1.5;
}

.home-market-links a i {
  color: #d70000;
  font-size: 20px;
}

/* —— عرض المنتجات —— */
.products-control {
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: 0 8px 22px rgba(12, 14, 17, 0.06);
}

.products-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7f8fb;
  border: 1px solid #e2e6ef;
  border-radius: 14px;
  padding: 8px 10px 8px 12px;
  margin-bottom: 14px;
}

.products-search i {
  color: #d70000;
}

.products-search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  outline: none;
  min-width: 0;
}

.products-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.products-filters label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #5f6672;
}

.products-filters select {
  border: 1px solid #e2e6ef;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  background: #fff;
}

.products-table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid #e8eaf0;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(12, 14, 17, 0.06);
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.products-table th,
.products-table td {
  padding: 12px 14px;
  text-align: start;
  border-bottom: 1px solid #eef1f6;
  font-size: 13px;
}

.products-table th {
  background: #fafbfd;
  color: #5f6672;
  font-weight: 800;
  position: sticky;
  top: 0;
}

.products-table tbody tr:hover {
  background: #fff7f8;
}

.products-table .sku {
  font-weight: 800;
  color: #d70000;
  letter-spacing: 0.02em;
}

.products-table .name-cell strong {
  display: block;
  color: #1d222b;
  font-size: 14px;
}

.products-table .name-cell small {
  color: #8891a0;
  font-weight: 700;
}

.stock-pill,
.move-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 800;
}

.stock-pill.ok,
.status-pill.ok { background: rgba(16, 185, 129, 0.12); color: #047857; }
.stock-pill.low,
.status-pill.low { background: rgba(215, 0, 0, 0.1); color: #d70000; }
.move-pill.fast { background: rgba(215, 0, 0, 0.1); color: #d70000; }
.move-pill.mid { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.move-pill.slow { background: #eef2f7; color: #64748b; }

.market-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  max-width: min(92vw, 420px);
  text-align: center;
}

.market-toast.is-visible {
  opacity: 1;
}

/* Ads category grid - responsive layout for mobile */
.ads-cats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1200px) {
  .market-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ads-latest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-market-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ads-cats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .products-filters { grid-template-columns: 1fr; }
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-hero { padding: 28px 8px 18px; }
  .market-stat { min-width: calc(50% - 12px); flex: 1 1 calc(50% - 12px); }
}

@media (max-width: 768px) {
  .market-grid,
  .ads-latest-grid,
  .home-market-links { grid-template-columns: 1fr; }
  .products-search { flex-wrap: wrap; }
  .ads-cats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .market-page { padding-inline: 0.85rem; }
  .market-tabs { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 12px; -webkit-overflow-scrolling: touch; }
  .market-tab { flex: 0 0 auto; }
  .market-card { min-width: 0; }
  .market-card h3 { overflow-wrap: anywhere; }
  .card-actions { flex-wrap: wrap; }
  .btn-mini { min-height: 40px; }
}

@media (max-width: 480px) {
  .ads-cats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-stat { min-width: calc(50% - 8px); padding: 10px 12px; }
  .market-stat strong { font-size: 20px; }
  .market-hero h1 { font-size: clamp(24px, 7vw, 34px); }
  .market-hero p { font-size: 14px; }
  .market-toast { bottom: 72px; }
}
