/* =====================================================
   SherikTop — Modern UI (purple brand)
   Performance-aware, mobile-first, all device sizes.
   - Fluid typography (clamp)
   - backdrop-filter only when supported & user opts in
   - Reduced motion / transparency respected
   - Touch-friendly tap targets
   ===================================================== */

:root {
  /* Brand palette (from logo) */
  --brand-900: #2A1340;
  --brand-800: #3B1E5E;
  --brand-700: #4A2575;
  --brand-600: #5B2E8A;
  --brand-500: #7448B0;
  --brand-400: #8B5FBF;
  --brand-300: #B79BD9;
  --brand-200: #D9C7EC;
  --brand-100: #EDE3F7;
  --brand-50:  #F7F1FC;

  --cream-100: #FBF8F5;
  --cream-200: #F5F1EC;
  --cream-300: #EFE6DC;

  --accent-gold: #E0A933;
  --success: #1FA971;
  --danger:  #DC4D6B;
  --info:    #5B7FE5;

  --bg: var(--cream-200);
  --surface:        rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-soft:   rgba(255, 255, 255, 0.78);

  --text:      #1F1230;
  --text-soft: #4A3B5C;
  --muted:     #7C6E8C;
  --line:        rgba(91, 46, 138, 0.12);
  --line-strong: rgba(91, 46, 138, 0.22);

  --button-text: #ffffff;
  --primary-grad:       linear-gradient(135deg, #5B2E8A 0%, #8B5FBF 100%);
  --primary-grad-hover: linear-gradient(135deg, #4A2575 0%, #7448B0 100%);
  --gold-grad:          linear-gradient(135deg, #E0A933 0%, #F4C66F 100%);

  --shadow-sm: 0 4px 12px rgba(59, 30, 94, 0.08);
  --shadow:    0 12px 30px rgba(59, 30, 94, 0.12);
  --shadow-lg: 0 24px 60px rgba(59, 30, 94, 0.18);

  --radius-sm:   12px;
  --radius:      18px;
  --radius-lg:   24px;
  --radius-pill: 999px;

  /* Fluid sizes — scale smoothly from 320px to 1024px */
  --fs-xs:  clamp(11px, 2.6vw, 12px);
  --fs-sm:  clamp(12px, 3.0vw, 13px);
  --fs-md:  clamp(13px, 3.4vw, 14px);
  --fs-base:clamp(14px, 3.6vw, 15px);
  --fs-lg:  clamp(15px, 4.0vw, 17px);
  --fs-xl:  clamp(18px, 5.0vw, 22px);
  --fs-2xl: clamp(22px, 6.4vw, 28px);

  --pad-content: clamp(12px, 4vw, 22px);
  --gap-md:      clamp(10px, 3vw, 16px);

  --tg-button:      var(--brand-600);
  --tg-button-text: #ffffff;
}

/* -------- Reset -------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb  { background: var(--brand-200); border-radius: 999px; }
*::-webkit-scrollbar-track  { background: transparent; }

html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(ellipse at 0% 0%,   rgba(139, 95, 191, 0.18), transparent 55%),
    radial-gradient(ellipse at 100% 0%, rgba(224, 169, 51, 0.08), transparent 50%),
    radial-gradient(ellipse at 50% 100%,rgba(91, 46, 138, 0.10), transparent 60%),
    linear-gradient(180deg, #FBF8F5 0%, #F1E9F7 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
a   { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* =====================================================
   Background image overlay (admin-uploaded bg)
   ===================================================== */
body.has-bg-image {
  background-attachment: scroll; /* iOS Safari fixed-bg flicker fix */
}
body.has-bg-image::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg,
      rgba(42, 19, 64, 0.55) 0%,
      rgba(42, 19, 64, 0.35) 45%,
      rgba(42, 19, 64, 0.65) 100%);
  pointer-events: none;
}

/* =====================================================
   Layout shell
   ===================================================== */
.app-shell {
  width: 100%;
  max-width: 980px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}

/* =====================================================
   Header
   ===================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px var(--pad-content);
  padding-top: max(14px, env(safe-area-inset-top));
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(59, 30, 94, 0.06);
}
.app-header.compact {
  grid-template-columns: 44px 1fr 44px;
}
.app-header h1 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--brand-700);
}
.app-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.header-action {
  display: inline-flex;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--primary-grad);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.header-action svg { stroke: currentColor; }

/* =====================================================
   Content
   ===================================================== */
.content { padding: var(--pad-content); }
.with-bottom-nav { padding-bottom: 100px; }

.icon, svg {
  width: 19px; height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =====================================================
   Surfaces (cards) — solid by default for performance
   ===================================================== */
.search-card,
.hero-card,
.state,
.detail-card,
.subscribe-hero,
.plan,
.mini-card,
.card,
.quick-grid a,
.filter-sheet,
.bottom-nav {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

/* =====================================================
   Search
   ===================================================== */
.search-card {
  position: sticky;
  top: 76px;
  z-index: 25;
  padding: 12px;
  margin-bottom: 14px;
}
.search-row {
  display: grid;
  grid-template-columns: 22px 1fr 46px;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 0 6px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--cream-100);
  color: var(--muted);
  transition: border-color .2s, box-shadow .2s;
}
.search-row:focus-within {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(139, 95, 191, 0.15);
}
.search-row input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 500;
}
.search-row input::placeholder { color: var(--muted); }
.search-row button,
.sheet-header button,
.carousel-btn { border: 0; cursor: pointer; }
.search-row button {
  display: inline-flex;
  height: 40px; width: 40px;
  align-items: center; justify-content: center;
  border-radius: 13px;
  background: var(--primary-grad);
  color: var(--button-text);
}
.filter-summary {
  margin: 10px 4px 0;
  color: var(--brand-600);
  font-size: var(--fs-sm);
  font-weight: 700;
}

/* =====================================================
   Hero
   ===================================================== */
.hero-card {
  padding: clamp(16px, 4vw, 22px);
  margin-bottom: 14px;
  background: linear-gradient(135deg, #ffffff 0%, var(--brand-50) 100%);
}
.hero-card h2,
.section-heading h2,
.detail-body h2,
.subscribe-hero h2,
.state h2 {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--brand-900);
}
.hero-card p,
.section-heading p,
.subscribe-hero p,
.state p {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.5;
}
.hero-actions, .filter-actions, .sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

/* =====================================================
   Buttons
   ===================================================== */
.primary-link, .primary-btn, .secondary-btn,
.ghost-btn, .plain-btn, .call-btn, .secondary-link {
  display: inline-flex;
  min-height: 48px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: var(--fs-base);
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s, transform .15s;
  -webkit-user-select: none;
  user-select: none;
}
.primary-link, .primary-btn, .call-btn {
  background: var(--primary-grad);
  color: var(--button-text);
  box-shadow: var(--shadow-sm);
}
.secondary-btn, .secondary-link {
  background: var(--brand-100);
  color: var(--brand-700);
}
.ghost-btn {
  background: transparent;
  color: var(--brand-600);
  border: 1.5px solid var(--line-strong);
}
.plain-btn {
  background: var(--cream-300);
  color: var(--text-soft);
}
.wide { width: 100%; }

/* =====================================================
   Quick grid
   ===================================================== */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.quick-grid a {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 800;
  font-size: var(--fs-md);
}
.quick-grid span {
  display: inline-flex;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--brand-100);
  color: var(--brand-600);
}

/* =====================================================
   Section
   ===================================================== */
.section-heading { margin: 18px 4px 14px; }

/* =====================================================
   Card grid (listings)
   ===================================================== */
.cards { display: grid; gap: var(--gap-md); }

.card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}

.image-wrap {
  position: relative;
  height: clamp(170px, 50vw, 220px);
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand-100), var(--cream-200));
}
.detail-image { height: clamp(220px, 60vw, 320px); }

.slide {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .25s ease;
}
.slide.is-active { opacity: 1; }

.carousel-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 36px; height: 44px;
  transform: translateY(-50%);
  border-radius: var(--radius-pill);
  background: rgba(42, 19, 64, 0.55);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  transition: background .2s;
}
.carousel-btn:hover { background: rgba(42, 19, 64, 0.78); }
.carousel-btn.left  { left: 10px; }
.carousel-btn.right { right: 10px; }

.tag {
  position: absolute;
  top: 12px;
  z-index: 4;
  max-width: 58%;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.tag.audience { left: 12px; background: linear-gradient(135deg, #5B2E8A, #8B5FBF); }
.tag.property { right: 12px; background: linear-gradient(135deg, #1FA971, #2BC489); }

.dots {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.dot {
  width: 7px; height: 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.55);
  transition: width .2s, background .2s;
}
.dot.is-active { width: 22px; background: #fff; }

.card-body, .detail-body { padding: clamp(14px, 3.5vw, 18px); }

.detail-body h2 {
  margin: 0 0 4px;
  color: var(--brand-900);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.card-body h3 {
  margin: 0 0 10px;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--brand-900);
  letter-spacing: -0.01em;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.info-grid span,
.district {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.info-grid span svg,
.district svg { color: var(--brand-500); }

.description {
  display: -webkit-box;
  min-height: 44px;
  margin: 12px 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.date {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* =====================================================
   States
   ===================================================== */
.state {
  padding: clamp(20px, 5vw, 32px);
  color: var(--muted);
  text-align: center;
}

.load-more {
  width: 100%;
  margin: 18px 0 30px;
  background: var(--surface-strong);
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

/* =====================================================
   Filter sheet
   ===================================================== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 8, 38, 0.55);
  opacity: 0;
  transition: opacity .2s ease;
}
.filter-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 70;
  width: min(100%, 720px);
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -20px 60px rgba(20, 8, 38, 0.3);
  transform: translate(-50%, 105%);
  transition: transform .25s cubic-bezier(.2, .7, .3, 1);
  -webkit-overflow-scrolling: touch;
}
.sheet-open .sheet-backdrop { opacity: 1; }
.sheet-open .filter-sheet { transform: translate(-50%, 0); }

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-header strong {
  display: block;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--brand-900);
}
.sheet-header span {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.sheet-header button {
  display: inline-flex;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--brand-50);
  color: var(--brand-700);
}

.filter-sheet form { display: grid; gap: 12px; }
.filter-sheet label {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.filter-sheet input,
.filter-sheet select {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: var(--cream-100);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: border-color .2s, box-shadow .2s;
}
.filter-sheet input:focus,
.filter-sheet select:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(139, 95, 191, 0.15);
}
.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--brand-50);
}
.check-row input { width: 18px; height: 18px; accent-color: var(--brand-600); }
.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* =====================================================
   Detail page
   ===================================================== */
.detail-content {
  max-width: 760px;
  margin: 0 auto;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.detail-grid div {
  padding: 14px;
  border-radius: 16px;
  background: var(--brand-50);
  border: 1px solid var(--line);
}
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-grid strong {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-md);
  font-weight: 800;
  color: var(--brand-900);
}
.amenities, .locked-phone, .subscribe-hero {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--brand-50);
  border: 1px solid var(--line);
}
.amenities h3,
.locked-phone strong {
  display: block;
  margin: 0 0 8px;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--brand-900);
}
.amenities p,
.locked-phone p {
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: var(--fs-md);
  line-height: 1.5;
}
.locked-phone .call-btn { width: 100%; }

/* =====================================================
   Plans (subscribe)
   ===================================================== */
.plans { display: grid; gap: 14px; }
.plan {
  position: relative;
  padding: clamp(16px, 4vw, 22px);
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.plan.featured {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--surface-strong), var(--surface-strong)) padding-box,
    var(--primary-grad) border-box;
}
.plan h3 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--brand-900);
}
.plan strong {
  display: block;
  margin-top: 10px;
  font-size: var(--fs-2xl);
  font-weight: 900;
  color: var(--brand-700);
  letter-spacing: -0.02em;
}
.badge {
  position: absolute;
  top: 14px; right: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--gold-grad);
  color: #2A1340;
  font-size: var(--fs-xs);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(224, 169, 51, 0.35);
}

/* =====================================================
   Mini card (my listings)
   ===================================================== */
.mini-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 12px;
}
.mini-card img {
  width: 92px; height: 82px;
  object-fit: cover;
  border-radius: 14px;
}
.mini-card span {
  display: block;
  margin: 5px 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mini-actions a {
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: var(--fs-xs);
  font-weight: 800;
}

/* =====================================================
   Bottom nav
   ===================================================== */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  display: grid;
  width: min(100%, 980px);
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
  border-radius: 0;
  transform: translateX(-50%);
}
.bottom-nav a,
.bottom-nav button {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 6px 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
  transition: color .2s, background .2s;
}
.bottom-nav .is-active {
  color: var(--brand-700);
  background: var(--brand-100);
}
.bottom-nav .is-active span { color: var(--brand-600); }

/* =====================================================
   Utility
   ===================================================== */
.price-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--primary-grad);
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 800;
}

/* =====================================================
   Responsive
   ===================================================== */
/* Very small phones (<360px) — extra compact */
@media (max-width: 359px) {
  .hero-actions, .filter-actions, .sheet-actions { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .two-cols { grid-template-columns: 1fr; }
  .bottom-nav { padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { padding: 4px 2px; font-size: 10px; }
}

/* Tablet & up */
@media (min-width: 720px) {
  .image-wrap { height: 240px; }
  .cards      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-sheet form { grid-template-columns: repeat(2, 1fr); }
  .sheet-header,
  .sheet-actions,
  .check-row { grid-column: 1 / -1; }
}

/* Large desktop */
@media (min-width: 1024px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =====================================================
   PROGRESSIVE ENHANCEMENT — capable devices only
   ===================================================== */

/* Hover effects only for true mouse pointers (skip touch) */
@media (hover: hover) and (pointer: fine) {
  .header-action:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
  .primary-link:hover, .primary-btn:hover, .call-btn:hover {
    background: var(--primary-grad-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
  }
  .secondary-btn:hover, .secondary-link:hover { background: var(--brand-200); }
  .ghost-btn:hover { background: var(--brand-50); }
  .plain-btn:hover { background: var(--cream-200); }
  .quick-grid a:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
  .plan:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .load-more:hover { background: var(--brand-50); }
  .mini-actions a:hover { background: var(--brand-200); }
  .bottom-nav a:hover, .bottom-nav button:hover { color: var(--brand-600); background: var(--brand-50); }
}

/* Backdrop-filter only when supported AND user OK with transparency */
@media (prefers-reduced-transparency: no-preference) {
  @supports ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    .bottom-nav {
      background: rgba(255, 255, 255, 0.85);
      -webkit-backdrop-filter: blur(16px) saturate(140%);
      backdrop-filter: blur(16px) saturate(140%);
    }
    body.has-bg-image .search-card,
    body.has-bg-image .hero-card,
    body.has-bg-image .state,
    body.has-bg-image .detail-card,
    body.has-bg-image .subscribe-hero,
    body.has-bg-image .plan,
    body.has-bg-image .mini-card,
    body.has-bg-image .card,
    body.has-bg-image .quick-grid a,
    body.has-bg-image .filter-sheet,
    body.has-bg-image .bottom-nav {
      background: rgba(255, 255, 255, 0.82);
      -webkit-backdrop-filter: blur(18px) saturate(150%);
      backdrop-filter: blur(18px) saturate(150%);
      border-color: rgba(255, 255, 255, 0.5);
    }
  }
}

/* When backdrop-filter NOT supported and bg-image is active → use solid white surfaces for max readability */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  body.has-bg-image .search-card,
  body.has-bg-image .hero-card,
  body.has-bg-image .state,
  body.has-bg-image .detail-card,
  body.has-bg-image .subscribe-hero,
  body.has-bg-image .plan,
  body.has-bg-image .mini-card,
  body.has-bg-image .card,
  body.has-bg-image .quick-grid a,
  body.has-bg-image .filter-sheet,
  body.has-bg-image .bottom-nav {
    background: #ffffff;
    border-color: var(--line);
  }
  body.has-bg-image .app-header {
    background: rgba(42, 19, 64, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.18);
  }
}

/* Header on bg-image: solid purple gradient (no glass — was unreadable) */
body.has-bg-image .app-header {
  background: linear-gradient(135deg, #2A1340 0%, #5B2E8A 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}
body.has-bg-image .app-header h1 {
  color: #ffffff;
  text-shadow: none;
}
body.has-bg-image .app-header p { color: rgba(255, 255, 255, 0.85); }
body.has-bg-image .header-action { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* Section headings ("Yangi e'lonlar" etc) sit directly on bg-image — give them a readable pill */
body.has-bg-image .section-heading {
  padding: 14px 18px;
  border-radius: var(--radius);
  background: rgba(42, 19, 64, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
body.has-bg-image .section-heading h2 {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
body.has-bg-image .section-heading p {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
@media (prefers-reduced-transparency: no-preference) {
  @supports ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    body.has-bg-image .section-heading {
      background: rgba(42, 19, 64, 0.38);
      -webkit-backdrop-filter: blur(14px) saturate(140%);
      backdrop-filter: blur(14px) saturate(140%);
    }
  }
}

/* Make all card surfaces more opaque on bg-image so text stays readable */
body.has-bg-image .hero-card,
body.has-bg-image .search-card,
body.has-bg-image .state,
body.has-bg-image .detail-card,
body.has-bg-image .subscribe-hero,
body.has-bg-image .plan,
body.has-bg-image .mini-card,
body.has-bg-image .card,
body.has-bg-image .quick-grid a,
body.has-bg-image .filter-sheet {
  background: rgba(255, 255, 255, 0.95) !important;
}
body.has-bg-image .bottom-nav { background: rgba(255, 255, 255, 0.92) !important; }
body.has-bg-image .hero-card h2,
body.has-bg-image .hero-card p { color: var(--brand-900); }
body.has-bg-image .hero-card p { color: var(--text-soft); }

/* Reduced motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  body.has-bg-image { background-attachment: scroll; }
}

/* Reduced data — drop heavy effects */
@media (prefers-reduced-data: reduce) {
  body { background: var(--cream-200); }
  body.has-bg-image::before { background: rgba(42, 19, 64, 0.6); }
  .app-header, .bottom-nav { backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; }
}

/* High contrast — boost contrast on Windows high-contrast / forced-colors */
@media (forced-colors: active) {
  .primary-link, .primary-btn, .call-btn { background: ButtonText; color: ButtonFace; }
  .card, .hero-card, .panel { border: 1px solid CanvasText; }
}
