/**
 * Avito-style UX features — Priority 1 из AGENTS.md
 *  - skeleton loading на карточках
 *  - floating "to top" кнопка
 *  - favorites сердечко
 *  - view counter глазик
 *
 * НЕ перекрывает avito-theme.css — отдельный модуль.
 */

/* ============================================
   1. SKELETON LOADING
   ============================================ */
.avito-skeleton {
  background: linear-gradient(90deg,
    #ebebeb 0%,
    #f5f5f5 50%,
    #ebebeb 100%);
  background-size: 200% 100%;
  animation: avito-skeleton-pulse 1.4s ease-in-out infinite;
  border-radius: 6px;
  display: block;
}
@keyframes avito-skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.avito-skeleton-card {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  padding: 0;
}
.avito-skeleton-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #ebebeb;
}
.avito-skeleton-line {
  height: 14px;
  margin: 8px 12px;
  border-radius: 4px;
}
.avito-skeleton-line.short { width: 60%; }
.avito-skeleton-line.long  { width: 92%; }

/* ============================================
   2. FLOATING "TO TOP" BUTTON
   ============================================ */
.avito-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #00d359;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 211, 89, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s, background 0.15s;
  z-index: 1000;
}
.avito-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.avito-to-top:hover {
  background: #00b84e;
}
.avito-to-top svg { width: 20px; height: 20px; }

/* ============================================
   3. FAVORITES (сердечко на карточке)
   ============================================ */
.avito-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: background 0.15s, transform 0.15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.avito-fav-btn:hover {
  background: #fff;
  transform: scale(1.05);
}
.avito-fav-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #71747a;
  stroke-width: 2;
  transition: fill 0.15s, stroke 0.15s, transform 0.2s;
}
.avito-fav-btn.is-favorited svg {
  fill: #ff4053;
  stroke: #ff4053;
  animation: avito-fav-pop 0.3s ease;
}
@keyframes avito-fav-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ============================================
   4. VIEW COUNTER (глазик)
   ============================================ */
.avito-view-counter {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 4;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}
.avito-view-counter svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Mobile корректировки */
@media (max-width: 768px) {
  .avito-to-top { right: 16px; bottom: 16px; width: 44px; height: 44px; }
  .avito-fav-btn { width: 32px; height: 32px; }
  .avito-fav-btn svg { width: 16px; height: 16px; }
}
