/* ═══════════════════════════════════════════════════════════════════════════
   SKELETON LOADERS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f5 25%, #e8e8f0 50%, #f0f0f5 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 8px;
}

/* Ad card skeleton */
.skeleton-ad {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
}
.skeleton-ad-img {
  width: 100%;
  height: 135px;
  border-radius: 16px;
}
.skeleton-ad-line {
  margin: 8px 0 0;
  height: 14px;
  border-radius: 6px;
}
.skeleton-ad-line--short {
  width: 60%;
}
.skeleton-ad-line--medium {
  width: 80%;
}
.skeleton-ad-line--xs {
  width: 40%;
  height: 11px;
  margin-top: 6px;
}

/* List card skeleton (category screen) */
.skeleton-list-card {
  background: #FFFFFF;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
}
.skeleton-list-thumb {
  width: 76px;
  height: 76px;
  border-radius: 12px;
  flex-shrink: 0;
}
.skeleton-list-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skeleton-list-line {
  height: 14px;
  border-radius: 6px;
}
.skeleton-list-line--w80 { width: 80%; }
.skeleton-list-line--w55 { width: 55%; }
.skeleton-list-line--w40 { width: 40%; height: 11px; }

/* Chat list skeleton */
.skeleton-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #FFFFFF;
}
.skeleton-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.skeleton-chat-line { height: 13px; border-radius: 6px; }
.skeleton-chat-line--w70 { width: 70%; }
.skeleton-chat-line--w45 { width: 45%; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

#toast-container {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 380px;
}

.toast {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  background: #1C1C1E;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

.toast.toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--success { background: #34C759; }
.toast--error   { background: #FF3B30; }
.toast--info    { background: #635CFB; }

/* ═══════════════════════════════════════════════════════════════════════════
   PULL-TO-REFRESH INDICATOR
   ═══════════════════════════════════════════════════════════════════════════ */

.ptr-indicator {
  position: absolute;
  top: -48px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: top 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}
.ptr-indicator.ptr--visible {
  opacity: 1;
}
.ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #E5E5EA;
  border-top-color: #635CFB;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   IMAGE LAZY LOAD — fade in when loaded
   ═══════════════════════════════════════════════════════════════════════════ */

img.lazy {
  opacity: 0;
  transition: opacity 0.3s ease;
}
img.lazy.loaded {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 12px;
  text-align: center;
}
.empty-state-icon {
  font-size: 52px;
  line-height: 1;
  opacity: 0.55;
}
.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: #1C1C1E;
}
.empty-state-subtitle {
  font-size: 13px;
  color: #8E8E93;
  max-width: 240px;
  line-height: 1.4;
}
.empty-state-btn {
  margin-top: 8px;
  padding: 12px 24px;
  background: #635CFB;
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}
.empty-state-btn:active { transform: scale(0.97); }

/* ═══════════════════════════════════════════════════════════════════════════
   NETWORK ERROR BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

#network-error-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #FF3B30;
  color: #FFFFFF;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 8px 16px;
  z-index: 9997;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
#network-error-banner.visible {
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTON LOADING STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Smooth heart toggle animation */
.ad-heart-btn {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ad-heart-btn:active {
  transform: scale(0.82) !important;
}
.ad-heart-btn.heart-pop {
  animation: heartPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes heartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* Ripple on primary buttons */
.ripple-btn {
  position: relative;
  overflow: hidden;
}
.ripple-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleEffect 0.5s linear;
  pointer-events: none;
}
@keyframes rippleEffect {
  to { transform: scale(4); opacity: 0; }
}

/* ── Мои объявления (дизайн Figma 3810-314) ────────────────────────────────── */
/* Чипы статусов в белой шапке, гориз. скролл */
.myads-chips {
  display: flex;
  gap: 4px;
  padding: 8px 12px 12px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.myads-chips::-webkit-scrollbar { display: none; }
.myads-chip {
  flex: 0 0 auto;
  height: 27px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: #F2F2F7;
  color: #000;
  font-family: 'Onest', sans-serif;
  font-size: 12px;
  line-height: 15px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.myads-chip.active {
  background: #635CFB;
  color: #FFF;
}
/* Скруглить низ белой шапки как в макете */
#my-ads-panel .fav-header { border-radius: 0 0 8px 8px; }

/* Контент: карточки-списки на сером фоне */
#my-ads-panel .fav-content-wrap.myads-content {
  background: transparent;
  border-radius: 0;
  margin: 0;
  padding: 4px 0 88px;
  /* column, чтобы пустое состояние (.myads-empty flex:1) заняло всю высоту
     и отцентрировалось; на списке карточек не сказывается */
  display: flex;
  flex-direction: column;
}
.myads-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0; /* в column-контейнере список не сжимаем — иначе ломается скролл */
}
.myads-card {
  background: #FFF;
  border-radius: 8px;
  padding: 12px;
}
.myads-card-top {
  position: relative;
  display: flex;
  gap: 10px;
}
.myads-card-img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: #F3F4F6;
  flex-shrink: 0;
}
.myads-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 28px;
}
.myads-card-title {
  font-family: 'Onest', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 18px;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.myads-card-price {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 18px;
  color: #635CFB;
}
.myads-card-loc {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.myads-card-loc img {
  width: 12px;
  height: 15px;
  flex-shrink: 0;
}
.myads-card-loc span {
  font-family: 'Onest', sans-serif;
  font-size: 12px;
  line-height: 15px;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.myads-menu-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.myads-menu-btn img { width: 24px; height: 24px; display: block; }
.myads-card-divider {
  height: 1px;
  background: #E5E5EA;
  margin: 12px 0 13px;
}
.myads-card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.myads-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Onest', sans-serif;
  font-size: 12px;
  line-height: 15px;
  color: #000;
}
.myads-stat img { width: 20px; height: 20px; }
.myads-promote-btn {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 20px;
  border: none;
  border-radius: 12px;
  background: rgba(99, 92, 251, 0.15);
  color: #635CFB;
  font-family: 'Onest', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
}
.myads-promote-btn:active { background: rgba(99, 92, 251, 0.25); }

/* Продвинутое объявление: тариф уже оплачен, кнопка неактивна до конца срока */
.myads-promote-btn--on {
  background: #F2F2F7;
  color: #8E8E93;
  cursor: default;
}
.myads-promote-btn--on:active { background: #F2F2F7; }

/* Плашка активного тарифа (Figma 3908-1189): иконка + название + срок + подпись.
   Фон и иконка зависят от тарифа */
.myads-plan {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 12px;
  background: #F2F2F7;
}
.myads-plan--turbo   { background: #F4FFDD; }
.myads-plan--premium { background: #FFF5DF; }
.myads-plan--start   { background: #F1F4FF; }
.myads-plan-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  object-fit: contain;
}
.myads-plan-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.myads-plan-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.myads-plan-name {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 14px;
  line-height: 20px;
  color: #000;
}
.myads-plan-until {
  font-family: 'Onest', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #000;
}
.myads-plan-desc {
  font-family: 'Onest', sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 17px;
  color: #8E8E93;
}

/* Выпадающее меню карточки (⋯) */
.myads-menu-backdrop {
  position: absolute;
  inset: 0;
  z-index: 70;
  background: transparent;
}
.myads-menu {
  position: absolute;
  z-index: 71;
  width: 175px;
  border-radius: 12px 12px 16px 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  animation: myadsMenuIn 0.15s ease-out;
}
@keyframes myadsMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.myads-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 34px;
  padding: 8px;
  border: 1px solid #E5E5EA;
  border-top: none;
  background: #FFF;
  cursor: pointer;
  font-family: 'Onest', sans-serif;
  font-size: 14px;
  line-height: 18px;
  color: #000;
}
.myads-menu-item:first-child { border-top: 1px solid #E5E5EA; border-radius: 12px 12px 0 0; }
.myads-menu-item:last-child  { border-radius: 0 0 12px 12px; }
.myads-menu-item:active { background: #F2F2F7; }
.myads-menu-item img { width: 18px; height: 18px; }

/* Пустое состояние и скелетоны */
.myads-empty {
  padding: 40px 20px;
  text-align: center;
  font-family: 'Onest', sans-serif;
  font-size: 14px;
  color: #8E8E93;
}
.myads-skeleton-card {
  background: #FFF;
  border-radius: 8px;
  padding: 12px;
}
.myads-skeleton-card .sk-top { display: flex; gap: 10px; }
.myads-skeleton-card .sk-img { width: 72px; height: 72px; border-radius: 12px; }
.myads-skeleton-card .sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.myads-skeleton-card .sk-line { height: 14px; border-radius: 4px; }
.myads-skeleton-card .sk-line--w70 { width: 70%; }
.myads-skeleton-card .sk-line--w45 { width: 45%; }
.myads-skeleton-card .sk-line--w60 { width: 60%; }
.myads-skeleton-card .sk-btn { height: 44px; border-radius: 12px; margin-top: 16px; }

/* ── Шторка «Пожаловаться» ─────────────────────────────────────────────────── */
.report-other-text {
  width: 100%;
  box-sizing: border-box;
  margin-top: 16px;
  min-height: 80px;
  border: 1px solid #E5E5EA;
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 18px;
  color: #000;
  resize: none;
  outline: none;
}
.report-other-text:focus { border-color: #635CFB; }
.report-submit-btn {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 16px;
  border: none;
  border-radius: 12px;
  background: #635CFB;
  color: #FFF;
  font-family: var(--font);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}
.report-submit-btn:disabled { opacity: 0.4; }

/* Пустое состояние «Мои объявления» (дизайн Figma 3811-593).
   flex:1 не только центрирует блок, но и гарантирует, что пустая вкладка
   ровно заполняет контейнер (scrollHeight == clientHeight) и не прокручивается
   вовсе. Центрирование чувствительно к высоте контейнера — сдвиг высоты на
   N px двигает картинку на N/2 px, — поэтому высота панели меняться не должна */
.myads-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  text-align: center;
}
.myads-empty-img {
  width: 200px;
  height: 200px;
  margin-bottom: -8px; /* у картинки прозрачные поля — прижимаем текст вплотную */
}
.myads-empty-title {
  font-family: 'Onest', sans-serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 31px;
  color: #000;
  margin-bottom: 8px;
}
.myads-empty-desc {
  font-family: 'Onest', sans-serif;
  font-size: 14px;
  line-height: 18px;
  color: #8E8E93;
  max-width: 317px;
  margin-bottom: 24px;
}
.myads-empty-cta {
  display: block;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: #635CFB;
  color: #FFF;
  font-family: 'Onest', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 18px;
  cursor: pointer;
}
.myads-empty-cta:active { opacity: 0.85; }

/* Карточка «В модерации» — бейдж «На проверке» (дизайн Figma 3812-8) */
.myads-mod-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  min-width: 0;
}
.myads-mod-badge {
  flex: 0 0 auto;
  background: #FF8D28;
  color: #FFF;
  border-radius: 6px;
  padding: 3px 8px;
  font-family: 'Onest', sans-serif;
  font-size: 12px;
  line-height: 15px;
  white-space: nowrap;
}
.myads-mod-badge--rejected { background: #FF383C; }
.myads-mod-time {
  font-family: 'Onest', sans-serif;
  font-size: 12px;
  line-height: 15px;
  color: #8E8E93;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Свайп между вкладками «Мои объявления»: контент въезжает со стороны свайпа */
.myads-slide-left { animation: myadsSlideLeft .22s ease-out; }
.myads-slide-right { animation: myadsSlideRight .22s ease-out; }
@keyframes myadsSlideLeft {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes myadsSlideRight {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
