/* ============================================================
   CATALOG.CSS — Car catalog from Telegram channel
   ============================================================ */

/* Loading state */
.catalog-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.catalog-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
  font-size: 15px;
}

/* Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

@media (max-width: 420px) {
  .catalog-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Card */
.car-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.car-card:hover {
  border-color: var(--accent);
}

/* Photo carousel */
.car-card__photos {
  position: relative;
  aspect-ratio: 4/3;
  background: var(--bg3);
  overflow: hidden;
}

.car-card__photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  display: none;
}

.car-card__photos img.active {
  display: block;
}

.car-card__photos-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  cursor: pointer;
  z-index: 2;
}

.car-card__photos-nav--prev { left: 0; }
.car-card__photos-nav--next { right: 0; }

/* Photo dots */
.car-card__dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 3;
}

.car-card__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: background 0.2s;
}

.car-card__dot.active {
  background: var(--accent);
}

/* Photo counter */
.car-card__photo-count {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  z-index: 3;
}

/* No photo placeholder */
.car-card__no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 14px;
}

/* Card body */
.car-card__body {
  padding: 16px;
}

.car-card__caption {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Truncated text with expand */
.car-card__caption.truncated {
  max-height: 120px;
  overflow: hidden;
  position: relative;
}

.car-card__caption.truncated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg2));
}

.car-card__expand {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

.car-card__expand:hover {
  text-decoration: underline;
}

.car-card__date {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text2);
}

.car-card__cta {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.car-card__cta:hover {
  background: var(--accent);
  color: #000;
}

/* Lightbox */
.catalog-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.95);
  align-items: center;
  justify-content: center;
}

.catalog-lightbox.open {
  display: flex;
}

.catalog-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.catalog-lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}

.catalog-lightbox__prev,
.catalog-lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 48px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 10;
  line-height: 1;
}

.catalog-lightbox__prev { left: 16px; }
.catalog-lightbox__next { right: 16px; }

.catalog-lightbox__prev:hover,
.catalog-lightbox__next:hover {
  background: rgba(255,255,255,0.2);
}
