/* ═══════════════════════════════════════════════════════════════════════════
   Pet.Uz — Mini App Styles
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary:       #635CFB;
  --btn-bg:        #EEEDFF;
  --btn-bg-hover:  #DBD9FF;
  --text-dark:     #1A1A2E;
  --text-secondary:#8E8EA0;
  --text-btn:      #635CFB;
  --radius-btn:    14px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  /* v47 */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: #FFFFFF;
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.screen {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--tg-viewport-height, 100vh);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease, height 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 1;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  z-index: 10;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SPLASH SCREEN — Animated
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-splash {
  background: #635CFB;
  overflow: hidden;
}

/* SVG анимируется при появлении */
.splash-svg {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  animation: svgReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes svgReveal {
  from {
    opacity: 0;
    transform: scale(1.08) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Текст Pet.Uz поверх SVG */
.splash-title-overlay {
  position: absolute;
  z-index: 10;
  bottom: 42%;
  left: 0;
  right: 0;
  text-align: center;
  animation: titleRise 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.splash-title-overlay h1 {
  font-size: 42px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -1px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

@keyframes titleRise {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Пульсирующий лого-dot */
.splash-dot {
  position: absolute;
  z-index: 10;
  bottom: 38%;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  animation: dotPulse 1.5s ease-in-out 1s infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.7; }
  50% { transform: translateX(-50%) scale(1.6); opacity: 1; }
}

/* Fade out всего splash при переходе */
#screen-splash.fade-out {
  animation: splashOut 0.6s ease forwards;
}

@keyframes splashOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}



@keyframes splashIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LANGUAGE SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-language {
  background: #FFFFFF;
  align-items: stretch;
  justify-content: flex-start;
}

.lang-page {
  width: 100%;
  height: 100%;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 40px;
  overflow: hidden;
}

/* Картинка флагов — занимает свободное место */
.lang-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding-top: 24px;
}

.lang-image {
  max-width: 287px;
  max-height: 312px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Заголовок */
.lang-text-block {
  text-align: center;
  padding: 20px 8px 24px;
  
}

.lang-title {
  font-size: 17px;
  font-weight: 700;
  color: #1C1C1E;
  line-height: 1.4;
  margin-bottom: 6px;
}

.lang-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: #8E8E93;
}

/* Кнопки — всегда видны внизу */
.lang-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  
}

.lang-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: #EEEDFF;
  color: #635CFB;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.lang-btn:active { transform: scale(0.97); background: #DBD9FF; }
.lang-btn.selected {
  background: #635CFB;
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(99, 92, 251, 0.35);
}



/* ═══════════════════════════════════════════════════════════════════════════
   MAIN SCREEN — по скринам Figma
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-main {
  background: #F3F4F6;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

/* Header */
.m-header {
  background: #FFFFFF;
  padding: 16px 12px 12px;
  padding-top: 12px;
  border-radius: 0 0 8px 8px;
}
body.platform-ios .m-header,
body.platform-android .m-header,
body.platform-ios .profile-header,
body.platform-android .profile-header {
  padding-top: max(
    calc(env(safe-area-inset-top, 0px) * 1.4 + 24px),
    calc(var(--tg-content-safe-area-inset-top, 0px) * 1.4 + 24px)
  );
}
.m-header-inner {
  display: flex;
  align-items: center;
  gap: 4px;
}
.m-search-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  background: #F2F2F7; border-radius: 12px;
  padding: 0 14px; height: 40px;
}
.m-search {
  border: none; background: transparent;
  font-family: var(--font); font-size: 15px; color: #1C1C1E;
  width: 100%; outline: none;
}
.m-search::placeholder { color: #AEAEB2; }
.m-notification-btn {
  width: 40px; height: 40px;
  background: #F2F2F7;
  border-radius: 12px;
  border: none;
  display: flex; align-items: center; justify-content: center;
  
  cursor: pointer;
  padding: 0;
}

/* Scroll */
.m-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
.m-scroll::-webkit-scrollbar, .screen::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

.m-block {
  background: #FFFFFF;
  border-radius: 8px;
  padding-bottom: 16px;
}

/* Section title */
.m-section-title {
  font-size: 16px; font-weight: 700; color: #1C1C1E;
  padding: 16px 16px 10px;
}

/* ── Категории ────────────────────────────────────────────────────────────── */
.m-cats { padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }

.m-cats-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-big {
  background: #F2F2F7; border-radius: 12px;
  height: 84px; position: relative; overflow: hidden;
  padding: 14px 12px;
  cursor: pointer; transition: transform .15s;
}
.cat-big:active { transform: scale(.97); }
.cat-big span { font-size: 14px; font-weight: 700; color: #1C1C1E; position: relative; z-index: 1; display: block; }
/* Кошки — увеличенная, сдвинута правее и ниже */
.m-cats-row2 .cat-big:nth-child(1) img { position: absolute; right: -20px; bottom: -22px; width: 115px; height: 120px; object-fit: contain; }
/* Собаки — from SVG: card w=171 h=84, img offset left=86 top=-10 w=103 h=100 */
.m-cats-row2 .cat-big:nth-child(2) img { position: absolute; left: 50.3%; top: -13.9%; width: 103px; height: 100px; object-fit: contain; }

.m-cats-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-small {
  background: #F2F2F7; border-radius: 12px;
  height: 84px; position: relative; overflow: hidden;
  padding: 14px 10px;
  cursor: pointer; transition: transform .15s;
}
.cat-small:active { transform: scale(.95); }
.cat-small span { font-size: 11px; font-weight: 600; color: #1C1C1E; position: relative; z-index: 1; display: block; line-height: 1.2; }
/* Вязка — image2: rect x=15 y=172 w=106 h=46, card x=12 y=134 w=112 h=84 → centered, bottom:0 */
.cat-small:nth-child(1) img { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 112px; height: 50px; object-fit: contain; }
/* Приюты — image3: rect x=182 y=156 w=62 h=62, card x=132 y=134 w=112 h=84 → right:0 bottom:0 */
.cat-small:nth-child(2) img { position: absolute; right: -7px; bottom: -10px; width: 99px; height: 89px; object-fit: contain; }
/* Потерянные — image4: rect x=301 y=157 w=60 h=62, card x=252 y=134 w=112 h=84 → right:3 bottom:-1 */
.cat-small:nth-child(3) img { position: absolute; right: 3px; bottom: -1px; width: 60px; height: 62px; object-fit: contain; }


/* ── Популярные питомцы ───────────────────────────────────────────────────── */
.m-ads-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 16px; }
.m-ad {
  background: #FFFFFF; border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: transform .15s;
}
.m-ad:active { transform: scale(.97); }
.m-ad-img { width: 100%; height: 130px; object-fit: cover; }
.m-ad-body { padding: 8px 8px 10px; }
.m-ad-price { font-size: 14px; font-weight: 700; color: #1C1C1E; margin-bottom: 2px; }
.m-ad-name { font-size: 12px; color: #1C1C1E; margin-bottom: 6px; }
.ad-city { font-size: 11px; color: #8E8E93; }
.ad-time-today, .ad-time-yesterday { font-size: 11px; color: #8E8E93; }

/* ── Сервисы ──────────────────────────────────────────────────────────────── */
.m-services-row {
  display: flex; gap: 8px; padding: 0 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.m-services-row::-webkit-scrollbar { display: none; }
.svc-tab {
   flex-shrink: 0; width: 164px; height: 93px;
  border-radius: 12px; position: relative; overflow: hidden;
  padding: 10px 12px; cursor: pointer; transition: transform .15s;
}
.svc-tab:active { transform: scale(.97); }
.svc-tab span { font-size: 12px; font-weight: 700; position: relative; z-index: 1; display: block; white-space: nowrap; }
.svc-img { position: absolute; object-fit: contain; }

/* 1. Ветклиники */
.svc-tab:nth-child(1) { background: #635CFB; }
.svc-tab:nth-child(1) span { color: #FFFFFF; }
.svc-tab:nth-child(1) img { right: -5px; bottom: -5px; width: 117px; height: 90px; }

/* 2. Груминг */
.svc-tab:nth-child(2) { background: #E0DEFE; }
.svc-tab:nth-child(2) span { color: #1C1C1E; }
.svc-tab:nth-child(2) img { right: 0; bottom: 0; width: 104px; height: 83px; }

/* 3. Гостиницы / Зоомагазины */
.svc-tab:nth-child(3) { background: #F5F4FE; }
.svc-tab:nth-child(3) span { color: #1C1C1E; }
.svc-tab:nth-child(3) img { right: 0; bottom: 0; width: 97px; height: 81px; }

/* ── Add button ───────────────────────────────────────────────────────────── */
.m-add-btn {
  display: block; width: calc(100% - 32px); margin: 16px 16px 0;
  padding: 15px; background: #635CFB; color: #FFF;
  border: none; border-radius: 14px;
  font-family: var(--font); font-size: 16px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 16px rgba(99,92,251,.3); transition: transform .15s;
}
.m-add-btn:active { transform: scale(.97); }

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.m-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 76px; background: #FFFFFF;
  border-top: none;
  display: flex; align-items: stretch; justify-content: space-around;
  padding-bottom: 0; z-index: 100;
}
.m-nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: none; border: none; color: #0F172A;
  font-family: var(--font); font-size: 10px; font-weight: 500;
  cursor: pointer; padding: 0; transition: color .15s;
}
.m-nav-btn.active { color: #635CFB; }
.m-nav-btn span { font-size: 10px; }
.m-nav-plus {
  width: 44px; height: 44px; background: #635CFB;
  border-radius: 50%; flex: none;
  box-shadow: none;
  margin-bottom: 8px; padding: 0; color: #FFF;
}

/* ── Profile panel ────────────────────────────────────────────────────────── */
.profile-panel {
  position: absolute; top: 0; right: 0; bottom: 72px; left: 0;
  background: #F5F5F5;
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 50;
}
.profile-header {
  background: #FFFFFF;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 56px 16px 28px; gap: 12px;
  border-bottom: 1px solid #F0F0F0;
}
.profile-avatar {
  width: 72px; height: 72px;
  background: #EEEDFF; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}
.profile-name { font-size: 18px; font-weight: 700; color: #1C1C1E; }
.profile-menu { background: #FFFFFF; margin: 16px; border-radius: 16px; overflow: hidden; }
.profile-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-bottom: 1px solid #F5F5F5;
  cursor: pointer; transition: background .15s;
}
.profile-item:last-child { border-bottom: none; }
.profile-item:active { background: #F5F5F5; }
.profile-item-icon { font-size: 20px; width: 24px; text-align: center; }
.profile-item-label { flex: 1; font-size: 15px; font-weight: 500; color: #1C1C1E; }
.profile-item-arrow { font-size: 20px; color: #C7C7CC; }

.m-nav-btn.active { color: #635CFB; }
.m-nav-btn span { font-size: 10px; }
.m-nav-plus {
  width: 48px; height: 48px; background: #635CFB;
  border-radius: 50%; flex: none;
  box-shadow: 0 4px 14px rgba(99,92,251,.4);
  margin-bottom: 6px; padding: 0; color: #FFF;
}

/* ── Profile panel ───────────────────────────────────────────────────────── */
.profile-panel {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: #F5F5F5;
  flex-direction: column;
  overflow-y: auto;
  z-index: 50;
  padding-bottom: 16px;
}
.profile-header {
  background: #FFFFFF;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 16px;
  gap: 12px;
  border-bottom: 1px solid #F0F0F0;
}
.profile-avatar {
  width: 72px; height: 72px;
  background: #EEEDFF; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}
.profile-name { font-size: 18px; font-weight: 700; color: #1C1C1E; }
.profile-menu {
  background: #FFFFFF;
  margin: 16px;
  border-radius: 16px;
  overflow: hidden;
}
.profile-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #F5F5F5;
  cursor: pointer;
  transition: background .15s;
}
.profile-item:last-child { border-bottom: none; }
.profile-item:active { background: #F5F5F5; }
.profile-item-icon { font-size: 20px; width: 24px; text-align: center; }
.profile-item-label { flex: 1; font-size: 15px; font-weight: 500; color: #1C1C1E; }
.profile-item-arrow { font-size: 20px; color: #C7C7CC; }

.cats-header-top {
  padding: 4px;
  cursor: pointer;
  margin-left: -13px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.m-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F2F2F7;
  border-radius: 12px;
  padding: 10px 14px;
  height: 40px;
}
.m-search {
  border: none; background: transparent;
  font-family: var(--font); font-size: 15px; color: #3C3C43;
  width: 100%; outline: none;
}
.m-search::placeholder { color: #AEAEB2; }

/* Scroll area */
.m-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.m-scroll::-webkit-scrollbar { display: none; }

/* Белый блок y=118 h=230 */
.m-white-block {
  background: #FFFFFF;
  padding: 12px 12px 16px;
  margin-bottom: 8px;
}
.m-block-title {
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
  margin-bottom: 10px;
}

/* 2 карточки y=160 h=84, рядом */
.m-cards-row {
  display: flex;
  gap: 8px;
}
.m-banner-card {
  flex: 1;
  height: 84px;
  background: #FFFFFF;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding: 10px 0 0 10px;
}
.m-banner-info { z-index: 1; }
.m-banner-name {
  font-size: 11px; font-weight: 700;
  color: #1C1C1E; line-height: 1.3;
  max-width: 80px;
}
.m-banner-sub {
  font-size: 10px; color: #635CFB;
  margin-top: 3px; font-weight: 500;
}
.m-banner-img {
  position: absolute;
  right: 0; bottom: 0;
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 0 0 12px 0;
}

/* Заголовок секции */
.m-section-title {
  font-size: 15px; font-weight: 700;
  color: #1C1C1E;
  padding: 12px 12px 8px;
}

/* Категории — 3 в ряд (y=252 h=84 каждая w=112) */
.m-cats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px;
  margin-bottom: 4px;
}
.m-cat {
  background: #FFFFFF;
  border-radius: 12px;
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s;
}
.m-cat:active { transform: scale(.95); }
.m-cat-img {
  width: 48px; height: 42px;
  object-fit: contain;
}
.m-cat-more {
  width: 48px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #8E8E93; letter-spacing: 2px;
}
.m-cat span {
  font-size: 10px; font-weight: 600;
  color: #1C1C1E; text-align: center;
  line-height: 1.2; padding: 0 4px;
}

/* Объявления — 2 колонки (y=394 h=148 rx=16) */
.m-ads-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 12px 16px;
}
.m-ad {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s;
  box-shadow: none;
}
.m-ad:active { transform: scale(.97); }
.m-ad-img {
  width: 100%; height: 110px;
  object-fit: cover;
}
.m-ad-body { padding: 8px 8px 10px; }
.m-ad-name { font-size: 13px; font-weight: 400; color: #1C1C1E; }
.m-ad-price { font-size: 14px; font-weight: 700; color: #1C1C1E; margin-top: 2px; }
.m-ad-loc { font-size: 11px; color: #8E8E93; margin-top: 3px; }

/* Кнопка E'lon berish — y=1082 fill=#635CFB */
.m-add-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 16px 12px 0;
  padding: 15px;
  background: #635CFB;
  color: #FFF;
  border: none; border-radius: 14px;
  font-family: var(--font); font-size: 16px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99,92,251,.35);
  transition: transform .15s;
}
.m-add-btn:active { transform: scale(.97); }

/* Bottom nav — y=950 #635CFB active */
.m-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 72px;
  background: #FFFFFF;
  border-top: 1px solid #F0F0F5;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}
.m-nav-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none;
  color: #0F172A;
  font-family: var(--font); font-size: 10px; font-weight: 500;
  cursor: pointer; padding: 6px 0;
  transition: color .15s;
}
.m-nav-btn.active { color: #635CFB; }
.m-nav-btn span { font-size: 10px; }
.m-nav-plus {
  width: 48px; height: 48px;
  background: #635CFB; border-radius: 50%;
  flex: none;
  box-shadow: none;
  margin-bottom: 6px; padding: 0;
  color: #FFF;
}

#screen-main {
  background: #F3F4F6;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────── */
.main-header {
  background: #FFFFFF;
  padding: 52px 16px 12px;
  
  border-bottom: 1px solid #F0F0F5;
}

.main-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.main-header-info { display: flex; flex-direction: column; gap: 2px; }
.main-hello { font-size: 13px; color: #8E8E93; }
.main-username { font-size: 17px; font-weight: 700; color: #1C1C1E; }

.main-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #EEEDFF;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

/* Search */
.main-search {
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 8px;
}
.search-icon { font-size: 16px; }
.search-input {
  border: none; background: transparent;
  font-family: var(--font); font-size: 15px; color: #1C1C1E;
  width: 100%; outline: none;
}
.search-input::placeholder { color: #AEAEB2; }

/* ── Scroll ─────────────────────────────────────────────── */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
}
.main-scroll::-webkit-scrollbar { display: none; }

/* ── Section label ──────────────────────────────────────── */
.section-label {
  font-size: 16px;
  font-weight: 700;
  color: #1C1C1E;
  padding: 16px 16px 10px;
}

/* ── Banner row ─────────────────────────────────────────── */
.banner-row {
  display: flex;
  gap: 10px;
  padding: 0 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.banner-row::-webkit-scrollbar { display: none; }

.banner-card {
  min-width: 172px;
  height: 88px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  position: relative;
  overflow: hidden;
  
  scroll-snap-align: start;
}
.banner-card-text { z-index: 1; }
.banner-card-title { font-size: 12px; font-weight: 700; color: #1C1C1E; line-height: 1.3; }
.banner-card-sub { font-size: 10px; color: #635CFB; margin-top: 2px; }
.banner-card-img {
  width: 74px; height: 79px;
  object-fit: cover;
  position: absolute; right: 0; bottom: 0;
  border-radius: 0 0 12px 0;
}

/* ── Categories grid ────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.cat-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.cat-card:active { transform: scale(0.95); }
.cat-card img {
  width: 52px; height: 46px;
  object-fit: contain;
  border-radius: 8px;
}
.cat-card span { font-size: 11px; font-weight: 600; color: #1C1C1E; text-align: center; }

/* ── Ads grid ───────────────────────────────────────────── */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.ad-card {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.ad-card:active { transform: scale(0.97); }
.ad-img {
  width: 100%; height: 130px;
  object-fit: cover;
}
.ad-info { padding: 8px 10px 10px; }
.ad-title { font-size: 13px; font-weight: 600; color: #1C1C1E; }
.ad-price { font-size: 13px; font-weight: 700; color: #635CFB; margin-top: 2px; }
.ad-location { font-size: 11px; color: #8E8E93; margin-top: 3px; }

/* ── Add button ─────────────────────────────────────────── */
.add-btn {
  display: block;
  margin: 20px 16px 0;
  width: calc(100% - 32px);
  padding: 16px;
  background: #635CFB;
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 16px rgba(99, 92, 251, 0.35);
}
.add-btn:active { transform: scale(0.97); }

/* ── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  background: #FFFFFF;
  border-top: 1px solid #F0F0F5;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: #AEAEB2;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.15s ease;
}
.nav-btn.active { color: #635CFB; }
.nav-btn span { font-size: 10px; }

.nav-add {
  width: 52px; height: 52px;
  background: #635CFB;
  border-radius: 50%;
  flex: none;
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(99, 92, 251, 0.4);
  margin-bottom: 8px;
  padding: 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   ЭКРАН КАТЕГОРИИ (Кошки и др.)
   ══════════════════════════════════════════════════════════════════════════════ */
#screen-cats {
  background: #F3F4F6;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}

/* Заголовок экрана */
.cat-screen-header {
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 54px 16px 14px;
  
}
.cat-back-btn {
  background: none; border: none;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
}
.cat-screen-title {
  font-size: 17px; font-weight: 700; color: #1C1C1E;
}

/* Фильтры */
.cat-filters-wrap {
  background: #FFFFFF;
  padding: 0 0 12px;
  
}
.cat-filters {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  overflow-x: auto;
}
.cat-filters::-webkit-scrollbar { display: none; }
.cat-filter-btn {
  white-space: nowrap;
  background: #F2F2F7;
  border: none;
  border-radius: 20px;
  padding: 7px 16px;
  font-family: var(--font);
  font-size: 13px; font-weight: 500;
  color: #1C1C1E;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cat-filter-btn.active {
  background: #635CFB;
  color: #FFFFFF;
}

/* Список карточек */
.cat-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cat-list::-webkit-scrollbar { display: none; }

/* Карточка объявления */
.cat-ad-card {
  background: #FFFFFF;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  position: relative;
}
.cat-ad-img {
  width: 76px; height: 76px;
  border-radius: 12px;
  object-fit: cover;
  
}
.cat-ad-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cat-ad-price {
  font-size: 15px; font-weight: 700; color: #1C1C1E;
}
.cat-price-free {
  color: #34C759;
}
.cat-ad-name {
  font-size: 13px; font-weight: 500; color: #1C1C1E;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-ad-meta {
  font-size: 12px; color: #AEAEB2;
}
.cat-ad-fav {
  background: none; border: none;
  padding: 4px; cursor: pointer;
  display: flex; align-items: center;
  
}
.cat-ad-fav:active svg path { stroke: #FF3B30; }

/* ── Шапка экрана Кошки ─────────────────────────────────────────────────────── */
#screen-cats {
  width: 100%;
  left: 0;
  right: 0;
  background: #F2F2F7;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
/* Белая карточка сверху (как в Container.svg) */
.cats-top-card {
  background: #FFFFFF;
  border-radius: 0 0 8px 8px;
  padding: 16px 12px 12px;
  padding-top: 12px;
  
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: none;
}
body.platform-ios .cats-top-card,
body.platform-android .cats-top-card {
  padding-top: max(
    calc(env(safe-area-inset-top, 0px) * 1.3 + 24px),
    calc(var(--tg-content-safe-area-inset-top, 0px) * 1.3 + 24px)
  );
}
/* Строка поиска — pin | input | equalizer */
.cats-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  padding: 0;
  height: 44px;
}
.cats-search-input {
  border: none; background: transparent;
  font-family: var(--font); font-size: 15px; color: #1C1C1E;
  flex: 1; outline: none;
}
.cats-search-input::placeholder { color: #AEAEB2; }
.cats-city-text {
  flex: 1;
  font-family: var(--font);
  font-size: 15px; font-weight: 600;
  color: #1C1C1E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cats-city-sub {
  font-weight: 400;
  color: #AEAEB2;
}
/* Ряд чипов-фильтров */
.cats-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.cats-chips-row::-webkit-scrollbar { display: none; }
.cats-chip {
  display: flex; align-items: center; gap: 4px;
  white-space: nowrap;
  background: #F2F2F7;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-family: var(--font);
  font-size: 13px; font-weight: 500;
  color: #1C1C1E;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cats-chip.active {
  background: #635CFB;
  color: #FFFFFF;
}
/* Тело экрана */
.cats-body {
  flex: 1;
  overflow-y: auto;
  background: #FFFFFF;
  border-top: none;
  margin-top: 4px;
  border-radius: 8px 8px 0 0;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.cats-body::-webkit-scrollbar {
  display: none; /* Webkit */
}
.cats-sort-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px 12px;
  background: #FFFFFF;
}
#screen-cats .m-ad {
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
#screen-cats .m-ad-img {
  width: 100%;
  border-radius: 16px;
  height: 135px;
  object-fit: cover;
}
#screen-cats .m-ad-body {
  padding: 8px 0 10px;
}
.cats-ads-count {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: #1C1C1E;
}
.cats-sort-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.cats-sort-label {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: #8E8E93;
}
.cats-sort-value {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: #635CFB;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS (Breeds, etc.)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--tg-viewport-height, 100vh);
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  /* Closing: fade out slightly delayed so slide down is visible */
  transition: opacity 0.25s ease 0.1s, visibility 0.4s ease, height 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.modal-overlay--scroll {
  /* no special scroll - sheet handles it */
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  /* Opening: fade in immediately */
  transition: opacity 0.3s ease, visibility 0.3s ease, height 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.modal-sheet {
  background: #FFFFFF;
  border-radius: 24px 24px 0 0;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 1;
  min-height: 0;
  max-height: 92vh;
  max-height: 92dvh;
  transform: translateY(100%);
  /* Закрытие: плавное ускорение (ease-in) */
  transition: transform 0.35s cubic-bezier(0.4, 0, 1, 1);
}
body.tg-expanded .modal-sheet {
  max-height: 82vh;
  max-height: 82dvh;
}
.modal-overlay.active .modal-sheet {
  transform: translateY(0);
  /* Открытие: плавное замедление (ease-out) */
  transition: transform 0.4s cubic-bezier(0, 0, 0.2, 1);
}
.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  position: relative;
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  color: #1C1C1E;
  margin: 0;
}
.modal-close {
  background: #F2F2F7;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #8E8E93;
  cursor: pointer;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.modal-list {
  padding: 0 16px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal-list::-webkit-scrollbar { display: none; }
.modal-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  cursor: pointer;
}
.modal-list-item-text {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: #1C1C1E;
}
.modal-list-item input[type="radio"] {
  display: none;
}
.radio-custom {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: relative;
  transition: all 0.18s ease-in-out;
  flex-shrink: 0;
  border: none;
  background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10.5' stroke='%23C7C7CC' stroke-width='1.5'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}
.modal-list-item input[type="radio"]:checked ~ .radio-custom {
  background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z' fill='%23635CFB'/%3E%3Cpath d='M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2Z' stroke='%23635CFB'/%3E%3Cpath d='M12 7C14.7614 7 17 9.23858 17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7Z' fill='white'/%3E%3Cpath d='M12 7C14.7614 7 17 9.23858 17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7Z' stroke='%23635CFB'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}
.modal-footer {
  padding: 10px 12px;
  padding-bottom: max(16px, calc(12px + env(safe-area-inset-bottom)));
  flex-shrink: 0;
  background: #FFFFFF;
}
.modal-apply-btn {
  width: 100%;
  background: #635CFB;
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.modal-apply-btn:active { transform: scale(0.97); }

/* ── Action Sheet (Поделиться / Пожаловаться) ──────────────────────────── */
.action-sheet-handle {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: #D1D1D6;
  margin: 8px auto 0;
  flex-shrink: 0;
}
.action-sheet-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border: none;
  background: #FFFFFF;
  font-family: var(--font);
  font-size: 16px;
  color: #323232;
  cursor: pointer;
  flex-shrink: 0;
}
.action-sheet-btn:active {
  background: #F2F2F7;
}
.action-sheet-divider {
  height: 1px;
  background: #F2F2F7;
  margin: 0 16px;
  flex-shrink: 0;
}

/* ── Price Modal ─────────────────────────────────────────────────────────── */
.price-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 16px 14px;
  border-bottom: 1px solid #F2F2F7;
  flex-shrink: 0;
}
.price-reset-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: #635CFB;
  cursor: pointer;
  padding: 0;
}
.price-modal-body {
  padding: 16px 16px 8px;
}
.price-currency-row {
  display: flex;
  gap: 0;
  background: #F2F2F7;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 14px;
  width: fit-content;
}
.price-currency-tab {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: #8E8E93;
  cursor: pointer;
  padding: 5px 16px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.price-currency-tab.active {
  background: #FFFFFF;
  color: #1C1C1E;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.price-inputs-row {
  display: flex;
  gap: 12px;
}
.price-input-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #F2F2F7;
  border-radius: 8px;
  padding: 13px 14px;
  border: 1.5px solid #E5E5EA;
  transition: border-color 0.2s;
}
.price-input-box:focus-within {
  border-color: #635CFB;
  background: #FFFFFF;
}
.price-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: #1C1C1E;
  outline: none;
  width: 100%;
}
.price-input::placeholder { color: #8E8E93; }
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ─── Основной фильтр ─────────────────────────────────────────────────────── */
#main-filter-modal.modal-overlay {
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
#main-filter-modal .modal-sheet {
  background: #F3F4F6 !important;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  border-radius: 0;
  position: relative;
  /* Закрытие: плавное ускорение для большого окна */
  transition: transform 0.4s cubic-bezier(0.4, 0, 1, 1);
}
#main-filter-modal.modal-overlay.active .modal-sheet {
  /* Открытие: плавное замедление */
  transition: transform 0.45s cubic-bezier(0, 0, 0.2, 1);
}
#main-filter-modal .modal-header {
  background: #FFFFFF;
  border-bottom: 1px solid #F2F2F7;
  padding: 18px 16px 14px;
  padding-top: 12px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
body.platform-ios #main-filter-modal .modal-header,
body.platform-android #main-filter-modal .modal-header {
  padding-top: max(
    calc(env(safe-area-inset-top, 0px) * 1.3 + 24px),
    calc(var(--tg-content-safe-area-inset-top, 0px) * 1.3 + 24px)
  );
}
.filter-chip {
  height: 34px;
  padding: 0 16px;
  background: #FFFFFF;
  border: 1px solid #E5E5EA;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: #1C1C1E;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.filter-chip.active {
  background: rgba(99, 92, 251, 0.2) !important;
  border-color: #635CFB !important;
  color: #1C1C1E !important;
}
.filter-chip:active {
  transform: scale(0.96);
}
.filter-checkbox-custom {
  position: absolute;
  top: 0; left: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #C7C7CC;
  transition: all 0.2s;
  background-color: transparent;
}
.filter-checkbox-input:checked ~ .filter-checkbox-custom {
  border-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M16 28C17.5759 28 19.1363 27.6896 20.5922 27.0866C22.0481 26.4835 23.371 25.5996 24.4853 24.4853C25.5996 23.371 26.4835 22.0481 27.0866 20.5922C27.6896 19.1363 28 17.5759 28 16C28 14.4241 27.6896 12.8637 27.0866 11.4078C26.4835 9.95189 25.5996 8.62902 24.4853 7.51472C23.371 6.40042 22.0481 5.5165 20.5922 4.91345C19.1363 4.31039 17.5759 4 16 4C12.8174 4 9.76516 5.26428 7.51472 7.51472C5.26428 9.76515 4 12.8174 4 16C4 19.1826 5.26428 22.2348 7.51472 24.4853C9.76516 26.7357 12.8174 28 16 28ZM15.6907 20.8533L22.3573 12.8533L20.3093 11.1467L14.576 18.0253L11.6093 15.0573L9.724 16.9427L13.724 20.9427L14.756 21.9747L15.6907 20.8533Z' fill='%23635CFB'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 24px 24px;
}

/* ─── Main Filter Card & Header Alignments ─── */
#main-filter-modal .modal-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  position: absolute;
  left: -1px;
  bottom: 8px;
}
#main-filter-modal .price-reset-btn {
  position: absolute;
  right: 16px;
  bottom: 14px;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  color: #635CFB;
  cursor: pointer;
  padding: 0;
}
.filter-card {
  background: #FFFFFF !important;
  border-radius: 8px !important;
  padding: 16px 12px 12px 12px !important;
  border: none !important;
  box-shadow: none !important;
}
.filter-card.filter-card--row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.filter-card-title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
  margin-bottom: 12px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-chips.filter-chips--grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.filter-card-text {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: #1C1C1E;
}
.filter-checkbox-wrap {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: block;
}
.filter-checkbox-input {
  display: none;
}
.modal-list--filter {
  background: #F3F4F6 !important;
  padding: 4px 0 8px 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

.filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-chip-large {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  background: #FFFFFF;
  border: 1px solid #E5E5EA;
  border-radius: 8px;
  display: flex;
  align-items: center;
  margin-right: 12px;
}

#main-filter-modal .modal-footer {
  position: static;
  background: #FFFFFF !important;
  padding: 10px 12px !important;
  padding-bottom: max(16px, calc(12px + env(safe-area-inset-bottom))) !important;
}

.chat-bubble-time {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  line-height: 1;
}

.chat-msg--sent .chat-bubble-time {
  text-align: right;
  color: #FFFFFF;
}

.chat-msg--received .chat-bubble-time {
  text-align: left;
  color: #B0B0B0;
}

/* ---------------------------------------------------------------------------
   AD DETAILS SCREEN (????????? ?? ????????)
   --------------------------------------------------------------------------- */
#screen-ad-details {
  background: #FFFFFF;
  z-index: 200;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

/* Header */
.ad-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  z-index: 210;
}
.ad-back-btn, .ad-action-btn {
  background: none;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  padding: 4px;
}
.ad-back-btn {
  margin-left: -9px;
}
.ad-header-actions {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Scroll area */
.ad-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 56px;
}
.ad-scroll::-webkit-scrollbar { display: none; }

/* Slider */
.ad-slider-container {
  background: #FFFFFF;
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.ad-slider {
  width: 100%;
  height: 280px;
  background: #E5E5EA;
}
.ad-slider-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}
.ad-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #E5E5EA;
}
.ad-dot.active {
  background: #635CFB;
}

/* Blocks */
.ad-block {
  background: #FFFFFF;
  padding: 16px;
  margin-bottom: 4px;
}
.ad-date {
  font-size: 11px;
  color: #8E8E93;
  margin-bottom: 6px;
}
.ad-title {
  font-size: 18px;
  font-weight: 500;
  color: #1C1C1E;
  margin-bottom: 8px;
}
.ad-price-large {
  font-size: 22px;
  font-weight: 800;
  color: #1C1C1E;
  margin-bottom: 16px;
}
.ad-currency {
  font-size: 16px;
  font-weight: 600;
}
.ad-tag {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #635CFB;
  border-radius: 6px;
  color: #635CFB;
  font-size: 12px;
  font-weight: 500;
}

.ad-block-title {
  font-size: 16px;
  font-weight: 700;
  color: #1C1C1E;
  margin-bottom: 12px;
}
.ad-desc {
  font-size: 14px;
  line-height: 1.5;
  color: #1C1C1E;
}

/* Seller Block */
.ad-seller-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ad-seller-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ad-seller-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #E5E5EA;
}
.ad-seller-name {
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
  margin-bottom: 4px;
}
.ad-seller-status {
  font-size: 12px;
  color: #8E8E93;
}
.ad-seller-stats {
  display: flex;
  gap: 8px;
}
.ad-stat-item {
  flex: 1;
  background: #F3F4F6;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.ad-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
  margin-bottom: 4px;
}
.ad-stat-lbl {
  font-size: 11px;
  color: #8E8E93;
}

/* Bottom Bar */
.ad-bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: #FFFFFF;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 12px;
  z-index: 210;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}
.ad-btn-primary {
  flex: 1;
  background: #635CFB;
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s;
}
.ad-btn-primary:active { transform: scale(.97); }

.ad-btn-secondary {
  flex: 1;
  background: #EEEDFF;
  color: #635CFB;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s;
}
.ad-btn-secondary:active { transform: scale(.97); }

/* ─── Ad Popup Menu ─────────────────────────────────────────────────── */
.ad-popup-menu {
  position: absolute;
  top: 68px;
  right: 12px;
  width: 228px;
  border-radius: 12px;
  overflow: hidden;
  z-index: 220;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(-8px) translateZ(0);
  transform-origin: top right;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.3s ease;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.ad-popup-menu.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0) translateZ(0);
}
.ad-popup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #000000;
  -webkit-tap-highlight-color: transparent;
}
.ad-popup-item:active {
  background: rgba(0, 0, 0, 0.08);
}
.ad-popup-item--danger .ad-popup-text {
  color: #FF3B30;
}
.ad-popup-divider {
  height: 0.5px;
  background: rgba(17, 17, 17, 0.25);
  margin: 0;
}
.ad-popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 215;
}


/* ─── Phone Contact Popup ────────────────────────────────────────────────── */
.phone-popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.phone-popup-overlay.active {
  opacity: 1;
  visibility: visible;
}
.phone-popup-box {
  width: calc(100% - 50px);
  max-width: 300px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: scale(0.95) translateY(10px) translateZ(0);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.phone-popup-overlay.active .phone-popup-box {
  transform: scale(1) translateY(0) translateZ(0);
}
.phone-popup-call {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #007AFF;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.phone-popup-call:active {
  background: rgba(0, 0, 0, 0.06);
}
.phone-popup-divider {
  height: 0.33px;
  background: rgba(60, 60, 67, 0.36);
}
.phone-popup-cancel {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #8E8E93;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.phone-popup-cancel:active {
  background: rgba(0, 0, 0, 0.06);
}


/* Hide HTML back buttons in Telegram (using native BackButton instead) */
body.tg-active .ad-back-btn,
body.tg-active .modal-back-btn {
  visibility: hidden;
  pointer-events: none;
}



/* ─── Telegram iOS FULLSCREEN: offset below status bar + TG nav bar ──────── */
body.tg-active.platform-ios.tg-fullscreen .ad-header {
  top: calc(env(safe-area-inset-top, 0px) + 23px);
  height: 56px;
  background: #FFFFFF;
  align-items: flex-end;
  padding-bottom: 8px;
}
body.tg-active.platform-ios.tg-fullscreen .ad-scroll {
  margin-top: calc(56px + env(safe-area-inset-top, 0px) + 23px);
}

/* ═══════════════════ CHAT SCREEN ═══════════════════ */
#screen-chat {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: #FFFFFF;
  height: 100%;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  background: #FFFFFF;
  border-bottom: 4px solid #F3F4F6;
  flex-shrink: 0;
  z-index: 10;
}
body.platform-ios .chat-header,
body.platform-android .chat-header {
  padding-top: max(
    calc(env(safe-area-inset-top, 0px) * 1.4 + 24px),
    calc(var(--tg-content-safe-area-inset-top, 0px) * 1.4 + 24px)
  );
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #E5E5EA;
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.chat-header-text {
  flex: 1;
  min-width: 0;
}
.chat-seller-name {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: #1C1C1E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-online {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #34C759;
  margin-top: 1px;
}
.chat-menu-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

/* Ad preview card */
.chat-ad-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 16px 0;
  padding: 8px 12px;
  background: #EAE8FF;
  border-radius: 12px;
  flex-shrink: 0;
}
.chat-ad-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #FFFFFF;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.chat-ad-info {
  flex: 1;
  min-width: 0;
}
.chat-ad-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #1C1C1E;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}
.chat-ad-price {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #1C1C1E;
  margin-top: 2px;
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-messages > *:first-child {
  margin-top: auto;
}
.chat-messages::-webkit-scrollbar { display: none; }

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #8E8E93;
  text-align: center;
  padding: 40px 20px;
}
.chat-empty-icon {
  font-size: 48px;
  opacity: 0.5;
}
.chat-empty-text {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #8E8E93;
}

/* Message bubbles */
.chat-msg {
  display: flex;
  max-width: 80%;
  margin-bottom: 2px;
}
.chat-msg--sent {
  align-self: flex-end;
}
.chat-msg--received {
  align-self: flex-start;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.4;
  position: relative;
  z-index: 0;
  word-wrap: break-word;
}

/* Sent Style */
.chat-msg--sent .chat-bubble {
  background: #635CFB;
  color: #FFFFFF;
  border-radius: 16px 16px 4px 16px;
}

/* Received Style */
.chat-msg--received .chat-bubble {
  background: #F2F2F7;
  color: #1C1C1E;
  border-radius: 16px 16px 16px 4px;
}



/* Input bar */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: #FFFFFF;
  flex-shrink: 0;
}
.chat-input-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  background: #FFFFFF;
  border: 1px solid #E5E5EA;
  border-radius: 16px;
  height: 48px;
  padding: 0 16px;
  box-sizing: border-box;
}
.chat-attach-btn {
  background: none;
  border: none;
  padding: 0;
  margin-right: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  height: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #1C1C1E;
  outline: none;
  -webkit-appearance: none;
}
.chat-input::placeholder { color: #8E8E93; }
.chat-send-btn {
  background: none;
  border: 1px solid #E5E5EA;
  border-radius: 16px;
  width: 48px;
  height: 48px;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform 0.15s;
}
.chat-send-btn:active { transform: scale(0.9); }

/* ─── Global Loader ─── */
.global-loader {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.global-loader.active {
  opacity: 1;
  visibility: visible;
}
.dot-flashing {
  display: flex;
  gap: 6px;
}
.dot-flashing div {
  width: 12px; height: 12px;
  background-color: #635CFB;
  border-radius: 50%;
  animation: dotFlashing 0.6s infinite alternate;
}
.dot-flashing div:nth-child(2) { animation-delay: 0.2s; }
.dot-flashing div:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotFlashing {
  0% { background-color: #635CFB; opacity: 1; transform: scale(1); }
  100% { background-color: #EAE8FF; opacity: 0.3; transform: scale(0.8); }
}
