:root {
  --dealify-blue: #0cc4e9;
  --dealify-gray: #979492;
  --dealify-pink: #fa5391;
  --text-dark: #111827;
  --text-main: #26323d;
  --muted: #64748b;
  --soft-bg: #f7fbfd;
  --border: rgba(12, 196, 233, 0.16);
  --card-shadow: 0 10px 26px rgba(8, 36, 51, 0.07);
  --blue-shadow: 0 10px 22px rgba(12, 196, 233, 0.18);
  --font-ios: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  background: #ffffff;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ios);
  color: var(--text-dark);
  background:
    radial-gradient(circle at top left, rgba(12, 196, 233, 0.075), transparent 28%),
    radial-gradient(circle at bottom right, rgba(151, 148, 146, 0.07), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f6f8fa 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.category-screen {
  position: relative;
  width: 100%;
  max-width: 1180px;
  min-height: 100vh;
  margin: 0 auto;
  background: transparent;
  padding-bottom: 34px;
}

.top-section {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px 14px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(151, 148, 146, 0.11);
  transform: translateY(0);
  transition: transform 0.36s cubic-bezier(.2,.8,.2,1), opacity 0.28s ease;
}

.top-section.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 0 8px;
  background: transparent;
}

.header-button {
  width: 42px;
  height: 42px;
  border: none;
  background: #ffffff;
  color: var(--dealify-blue);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 7px 18px rgba(12, 196, 233, 0.12);
  flex-shrink: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.header-button:hover {
  background: #f5fdff;
  box-shadow: 0 10px 22px rgba(12, 196, 233, 0.16);
}

.header-button:active {
  transform: scale(0.94);
}

.header-button i {
  font-size: 18px;
}

.profile-button {
  overflow: hidden;
}

.profile-button img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.header-title {
  flex: 1;
  margin: 0 12px;
  font-size: 19px;
  font-weight: 900;
  color: #1f2937;
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.25px;
}

.search-wrap {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  height: 50px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid rgba(151, 148, 146, 0.16);
  box-shadow:
    0 8px 22px rgba(151, 148, 146, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
}

.search-icon {
  color: var(--dealify-blue);
  margin-left: 16px;
  margin-right: 10px;
  font-size: 16px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 42px 0 0;
  font-size: 15px;
  font-weight: 650;
  color: #1f2937;
}

.search-input::placeholder {
  color: var(--dealify-blue);
  opacity: 0.78;
  font-weight: 700;
}

.search-clear {
  position: absolute;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(151, 148, 146, 0.12);
  color: #555;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear.active {
  display: inline-flex;
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 58px;
  z-index: 80;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(12, 196, 233, 0.12);
  box-shadow: 0 18px 36px rgba(8, 36, 51, 0.14);
  overflow: hidden;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f0f4f7;
  background: #ffffff;
}

.search-result-row:last-child {
  border-bottom: none;
}

.search-result-row:hover {
  background: rgba(12, 196, 233, 0.05);
}

.search-result-image {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: #eefafd;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dealify-blue);
}

.search-result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-info {
  min-width: 0;
  flex: 1;
}

.search-result-title {
  font-size: 14px;
  font-weight: 850;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-title mark {
  color: var(--dealify-blue);
  background: transparent;
}

.search-result-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 650;
}

.search-result-price {
  font-size: 13px;
  font-weight: 850;
  color: var(--dealify-blue);
  margin-top: 4px;
}

.category-actions {
  max-width: 760px;
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
  gap: 10px;
}

.filter-open-button,
.reset-filter-button {
  height: 44px;
  border: none;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.filter-open-button {
  background: var(--dealify-blue);
  color: #ffffff;
  box-shadow: var(--blue-shadow);
}

.sort-button {
  background: #ffffff;
  color: var(--dealify-blue);
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(151, 148, 146, 0.10);
}

.reset-filter-button {
  background: #f3f7f9;
  color: var(--dealify-blue);
  border: 1px solid rgba(151, 148, 146, 0.12);
}

.filter-open-button:active,
.reset-filter-button:active {
  transform: scale(0.98);
}

.listing-count-row {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 18px 8px;
  color: #667085;
  font-size: 13px;
  font-weight: 750;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.listing-count-row #visibleCount {
  color: var(--dealify-blue);
  font-weight: 950;
}

.category-chip-title {
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--dealify-blue);
  background: rgba(12, 196, 233, 0.09);
  font-size: 12px;
  font-weight: 850;
}

.listings-section {
  padding: 0 16px 28px;
}

.listings-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.listing-card {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 150px;
  background: #ffffff;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(151, 148, 146, 0.10);
  box-shadow: var(--card-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.listing-card:hover {
  transform: translateY(-2px);
  border-color: rgba(12, 196, 233, 0.20);
  box-shadow: 0 14px 32px rgba(8, 36, 51, 0.10);
}

.listing-left {
  width: 140px;
  min-width: 140px;
  height: 150px;
  position: relative;
  background: #f8f9fa;
  overflow: hidden;
}

.listing-image-slider {
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.listing-image-slider::-webkit-scrollbar {
  display: none;
}

.listing-image {
  width: 140px;
  min-width: 140px;
  height: 150px;
  object-fit: cover;
  scroll-snap-align: start;
  background: #f8f9fa;
  display: block;
}

.placeholder-image {
  width: 100%;
  height: 100%;
  background: #f3f6f8;
  color: #9aa4af;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-image i {
  font-size: 34px;
}

.image-counter {
  position: absolute;
  left: 8px;
  top: 8px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(12, 196, 233, 0.96);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 850;
  box-shadow: 0 6px 14px rgba(12, 196, 233, 0.20);
}

.image-counter i {
  font-size: 11px;
}

.listing-right {
  flex: 1;
  min-width: 0;
  padding: 14px 48px 12px 14px;
  cursor: pointer;
}

.listing-title {
  margin: 0 0 9px;
  color: #1f2937;
  font-size: 15.5px;
  font-weight: 850;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dealify-blue);
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  margin-bottom: 10px;
}

.aed-icon {
  width: 16px;
  height: auto;
  fill: var(--dealify-blue);
  stroke: var(--dealify-blue);
  stroke-width: 8;
  flex-shrink: 0;
}

.location-row,
.posted-row {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #667085;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
  margin-top: 6px;
  min-width: 0;
}

.location-row span,
.posted-row span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-row i,
.posted-row i {
  color: var(--dealify-pink);
  font-size: 12px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-action-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: var(--dealify-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.card-action-btn:active {
  transform: scale(0.94);
}

.favorite-btn.active {
  color: var(--dealify-pink);
}

.share-btn {
  color: var(--dealify-gray);
}

.empty-state {
  margin: 50px auto;
  max-width: 520px;
  padding: 34px 20px;
  background: #ffffff;
  border-radius: 24px;
  text-align: center;
  border: 1px solid rgba(151, 148, 146, 0.12);
  box-shadow: var(--card-shadow);
}

.empty-state i {
  font-size: 42px;
  color: var(--dealify-blue);
  margin-bottom: 12px;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: #1f2937;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.38);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-overlay.active {
  display: flex;
}

.filter-modal,
.sort-modal {
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 26px 26px 0 0;
  padding: 20px 18px 24px;
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.18);
  animation: modalUp 0.22s ease;
}

@keyframes modalUp {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  color: #1f2937;
  font-size: 20px;
  font-weight: 950;
}

.modal-close {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #f3f6f8;
  color: #555;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-group {
  margin-bottom: 20px;
}

.filter-label {
  display: block;
  margin-bottom: 10px;
  color: #1f2937;
  font-size: 14px;
  font-weight: 900;
}

.city-chips,
.subcategory-chips,
.price-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chip {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(12, 196, 233, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip.active {
  background: var(--dealify-blue);
  color: #ffffff;
  border-color: var(--dealify-blue);
  box-shadow: 0 7px 16px rgba(12, 196, 233, 0.18);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 18px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.5), #ffffff 24%);
  padding-top: 12px;
}

.clear-filter-btn,
.apply-filter-btn {
  min-height: 48px;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 900;
}

.clear-filter-btn {
  background: #f3f6f8;
  color: #344054;
}

.apply-filter-btn {
  background: var(--dealify-blue);
  color: #ffffff;
  box-shadow: var(--blue-shadow);
}

.sort-option {
  width: 100%;
  min-height: 56px;
  padding: 0 14px;
  border: none;
  border-top: 1px solid #f2f4f6;
  background: #ffffff;
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 850;
}

.sort-option:hover {
  background: rgba(12, 196, 233, 0.05);
}

.sort-check {
  color: var(--dealify-blue);
  opacity: 0;
}

.sort-check.active {
  opacity: 1;
}

@media (min-width: 760px) {
  .category-screen {
    padding-left: 22px;
    padding-right: 22px;
  }

  .top-section {
    border-radius: 0 0 26px 26px;
    box-shadow: 0 10px 28px rgba(8, 36, 51, 0.045);
    padding-left: 22px;
    padding-right: 22px;
  }

  .app-header {
    min-height: 70px;
  }

  .header-title {
    font-size: 22px;
  }

  .search-box {
    height: 54px;
  }

  .listings-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .listing-card {
    min-height: 168px;
  }

  .listing-left {
    width: 158px;
    min-width: 158px;
    height: 168px;
  }

  .listing-image {
    width: 158px;
    min-width: 158px;
    height: 168px;
  }

  .listing-title {
    font-size: 16px;
  }

  .listing-right {
    padding: 16px 50px 14px 16px;
  }

  .modal-overlay {
    align-items: center;
    padding: 22px;
  }

  .filter-modal,
  .sort-modal {
    border-radius: 26px;
    max-height: min(720px, 86vh);
  }
}

@media (min-width: 1024px) {
  .category-screen {
    padding-left: 28px;
    padding-right: 28px;
  }

  .top-section {
    padding-left: 28px;
    padding-right: 28px;
  }

  .listings-section {
    padding-left: 18px;
    padding-right: 18px;
  }

  .listings-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .listing-card {
    min-height: 182px;
  }

  .listing-left {
    width: 176px;
    min-width: 176px;
    height: 182px;
  }

  .listing-image {
    width: 176px;
    min-width: 176px;
    height: 182px;
  }

  .listing-title {
    font-size: 17px;
  }

  .price-row {
    font-size: 20px;
  }

  .location-row,
  .posted-row {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  body {
    background: #ffffff;
  }

  .category-screen {
    max-width: 100%;
  }

  .top-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .app-header {
    min-height: 62px;
  }

  .header-button {
    width: 40px;
    height: 40px;
  }

  .header-title {
    font-size: 17px;
  }

  .search-box {
    height: 50px;
    border-radius: 18px;
  }

  .category-actions {
    grid-template-columns: 1fr 1fr 40px;
    gap: 8px;
  }

  .filter-open-button,
  .reset-filter-button {
    height: 42px;
    border-radius: 14px;
    font-size: 13px;
  }

  .listing-count-row {
    padding-left: 16px;
    padding-right: 16px;
  }

  .listings-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .listing-card {
    border-radius: 20px;
  }

  .listing-left {
    width: 132px;
    min-width: 132px;
    height: 150px;
  }

  .listing-image {
    width: 132px;
    min-width: 132px;
    height: 150px;
  }

  .listing-right {
    padding-right: 44px;
  }
}

@media (max-width: 370px) {
  .top-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .listing-left {
    width: 118px;
    min-width: 118px;
    height: 144px;
  }

  .listing-image {
    width: 118px;
    min-width: 118px;
    height: 144px;
  }

  .listing-card {
    min-height: 144px;
  }

  .listing-title {
    font-size: 14.5px;
  }

  .price-row {
    font-size: 16px;
  }

  .location-row,
  .posted-row {
    font-size: 11.5px;
  }
}

[dir="rtl"] body {
  direction: rtl;
}

[dir="rtl"] .header-button i.fa-arrow-left {
  transform: scaleX(-1);
}

[dir="rtl"] .search-icon {
  margin-left: 10px;
  margin-right: 16px;
}

[dir="rtl"] .search-input {
  padding: 0 0 0 42px;
  text-align: right;
}

[dir="rtl"] .search-clear {
  right: auto;
  left: 10px;
}

[dir="rtl"] .listing-right {
  padding: 14px 14px 12px 48px;
}

[dir="rtl"] .card-actions {
  right: auto;
  left: 10px;
}

[dir="rtl"] .location-row,
[dir="rtl"] .posted-row {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
