@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap");

[hidden] { display: none !important; }

:root {
  --bg: #f6f1eb;
  --surface: #fffdfb;
  --text: #2a1f18;
  --muted: #7a695b;
  --line: #eadfce;
  --brand: #b05024;
  --brand-strong: #833a17;
  --accent: #bf2f42;
  --panel-shadow: 0 14px 30px rgba(74, 41, 21, 0.1);
  --card-shadow: 0 10px 22px rgba(77, 46, 24, 0.11);
  --radius-lg: 18px;
  --beige: #a3753562;
  --honey: #fffefd;
  --gold: #c89a2a;
  --gold-r: rgb(255, 183, 1);
  --active-green: #6f9b63;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Cairo", Tahoma, Arial, sans-serif;
  background: radial-gradient(circle at 85% -10%, #fff2dc 0, var(--bg) 36%, #f3ece4 100%);
  color: var(--text);
}

.container { width: min(1240px, 94vw); margin: 0 auto; }

.page-wrap { padding: 30px 0 44px; }
  .error-box {
    margin-bottom: 10px;
    background: #fff1f2;
    color: #b4233a;
    border: 1px solid #ffcfd6;
    border-radius: 12px;
    padding: 12px;
  }

  .browse-sticky {
    position: sticky;
    top: 122px;
    z-index: 48;
    margin-bottom: 14px;
    padding-bottom: 8px;
    background: linear-gradient(180deg, rgba(246, 241, 235, 0.95) 0%, rgba(246, 241, 235, 0.82) 100%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  .category-tabs {
    display: flex;
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    margin-bottom: 10px;
    background: var(--surface);
    box-shadow: 0 10px 18px rgba(65, 38, 20, 0.08);
    scroll-snap-type: x proximity;
  }

  .category-tabs .tab-chip {
    min-width: 128px;
    max-width: 170px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid #e3d6c8;
    background: #fffdfb;
    padding: 6px 10px;
    color: #4e4036;
    scroll-snap-align: start;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  }

  .category-tabs .chip-icon {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid #eadccc;
    flex: 0 0 34px;
  }

  .category-tabs .chip-label {
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .category-tabs .tab-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(74, 41, 21, 0.1);
    border-color: #d5bca3;
  }

  .category-tabs .tab-chip.active {
    background: #fff4ea;
    border-color: var(--brand);
    color: var(--brand-strong);
  }

  .category-tabs .tab-all {
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    border-color: transparent;
    color: #fff;
  }

  .category-tabs .tab-all .all-icon {
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
  }

  .category-tabs .tab-all.active {
    box-shadow: 0 8px 16px rgba(131, 58, 23, 0.28);
    color: #fff;
  }

  .filters {
    display: flex;
    justify-content: flex-start;
  }

  .filters select {
    border: 1px solid #d8cbbd;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
  }

  .ads-banner {
    margin-bottom: 16px;
    border-radius: 22px;
    padding: 14px;
    background: linear-gradient(180deg, #fff9f2 0%, #f8e4d5 100%);
    border: 1px solid rgba(234, 213, 195, 0.9);
    box-shadow: 0 8px 24px rgba(215, 176, 145, 0.14);
  }

  .ad-card {
    border: 1px solid rgba(225, 211, 197, 0.9);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    max-width: 100%;
  }

  .ad-card a {
    display: block;
  }

  .ad-card img,
  .ad-card video {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
  }

  .products-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

  .products-skeleton .skeleton-card {
    border-radius: 18px;
    min-height: 348px;
    background:
      linear-gradient(105deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.7) 50%, rgba(255, 255, 255, 0) 60%) #efe4d7;
    background-size: 200% 100%;
    animation: skeletonShift 1.1s linear infinite;
    border: 1px solid #e6d9ca;
  }

  @keyframes skeletonShift {
    to { background-position: -200% 0; }
  }

  .product-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
  }

  .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 34px rgba(74, 41, 21, 0.14);
  }

  .product-card img { width: 100%; height: 230px; object-fit: cover; }
  .product-card .box { padding: 13px; }
  .product-card .cat { font-size: 12px; color: var(--muted); }
  .product-card h3 {
    margin: 6px 0;
    font-size: 15px;
    min-height: 42px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .product-card .desc { margin: 0 0 6px; color: #6e6258; font-size: 12px; min-height: 34px; }
  .product-card .rating { font-size: 12px; color: #d1972d; }

  .price-wrap { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
  .product-card .price { color: var(--brand-strong); font-weight: 800; }
  .product-card .old-price { color: #9b8f84; text-decoration: line-through; font-size: 12px; }

  .discount-badge {
    background: linear-gradient(135deg, var(--accent), #991f31);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
  }

  .product-card button {
    width: 100%;
    border: none;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: #fff;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.14s ease, filter 0.14s ease;
  }

  .product-card button:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
  }

  .empty-state { text-align: center; padding: 50px 0; }
  .empty-state p { color: var(--muted); font-size: 18px; }
  .empty-state a { color: var(--brand-strong); text-decoration: none; font-weight: 700; }

  .site-footer {
    border-top: 1px solid var(--line);
    background: #fffaf4;
    margin-top: 22px;
  }

  .footer-wrap {
    padding: 18px 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

  .site-footer h4 {
    margin: 0;
    color: var(--brand-strong);
    font-size: 22px;
  }

  .site-footer p {
    margin: 6px 0 0;
    color: var(--muted);
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
  }

  .footer-links a {
    text-decoration: none;
    color: #5d4d44;
    font-weight: 700;
  }

  @media (max-width: 1024px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); }
    .browse-sticky { top: 118px; }
  }

  @media (max-width: 768px) {
    .browse-sticky { top: 116px; }
    .products-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-wrap { flex-direction: column; align-items: flex-start; }
  }

  @media (max-width: 560px) {
    .category-tabs .tab-chip {
      min-width: 118px;
      max-width: 140px;
      height: 44px;
      padding: 5px 8px;
    }
    .category-tabs .chip-icon { width: 30px; height: 30px; flex-basis: 30px; }
    .category-tabs .chip-label { font-size: 11px; }
  }
@media (max-width: 560px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); }
  .product-card img { aspect-ratio: 4 / 3; height: auto; }
  .category-tabs .tab-chip {
    min-width: 118px;
    max-width: 140px;
    height: 44px;
    padding: 5px 8px;
  }
  .category-tabs .chip-icon { width: 30px; height: 30px; flex-basis: 30px; }
  .category-tabs .chip-label { font-size: 11px; }
}
