/* ═══════════════════════════════════════
   АВТОПРЯМО — Shared Styles
   ═══════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────── */
:root {
  --color-primary: #1A2332;
  --color-accent: #0DB8A4;
  --color-accent-hover: #0AA089;
  --color-bg: #F5F4F0;
  --color-card: #FFFFFF;
  --color-text: #3D4450;
  --color-text-secondary: #6B7280;
  --color-border: #E5E3DE;
  --color-input-bg: #FAFAF8;

  --font-heading: 'Manrope', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 3px rgba(26,35,50,.06), 0 4px 12px rgba(26,35,50,.04);
  --shadow-hover: 0 2px 6px rgba(26,35,50,.08), 0 8px 24px rgba(26,35,50,.07);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

/* ── RESET & BASE ───────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* ── HEADER ─────────────────────────── */
.header {
  background: var(--color-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo span { color: var(--color-accent); }

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.btn-post-ad {
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 9px var(--space-md);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn-post-ad:hover { background: var(--color-accent-hover); }
.btn-post-ad:active { transform: scale(.97); }

/* ── LAYOUT ─────────────────────────── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-lg);
  display: flex;
  gap: var(--space-xl);
}

/* ── FILTERS (sidebar) ──────────────── */
.sidebar { width: 280px; flex-shrink: 0; }

.filters {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  position: sticky;
  top: 80px;
}

.filters__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filters__reset {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.filters__reset:hover { text-decoration: underline; }

.filter-group { margin-bottom: var(--space-md); }

.filter-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: var(--space-xs);
}

.filter-group select,
.filter-group input[type="number"],
.filter-group input[type="text"] {
  width: 100%;
  padding: 9px var(--space-sm);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  appearance: auto;
}

.filter-group select:focus,
.filter-group input:focus { border-color: var(--color-accent); }

.filter-row { display: flex; gap: var(--space-sm); }
.filter-row > * { flex: 1; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--color-border);
  background: var(--color-input-bg);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}

.chip:hover { border-color: var(--color-accent); color: var(--color-accent); }
.chip.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.filters__actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.btn-apply {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s;
}

.btn-apply:hover { background: var(--color-accent-hover); }

.btn-clear {
  padding: 10px var(--space-md);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
}

.btn-clear:hover { border-color: var(--color-text-secondary); color: var(--color-text); }

/* ── RESULTS BAR ────────────────────── */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.results-bar__count { font-weight: 600; color: var(--color-text); }

.sort-select {
  padding: 6px var(--space-sm);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-card);
  font-size: 13px;
  outline: none;
}

/* ── CARDS GRID ─────────────────────── */
.cards {
  display: grid;
  gap: var(--space-lg);
}

.card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow .25s, transform .2s;
  cursor: pointer;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card__img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: #E8E6E1;
}

.card__body { padding: var(--space-md); }

.card__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  line-height: 1.3;
}

.card__meta {
  display: flex;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.card__meta span + span::before {
  content: '·';
  margin-right: var(--space-xs);
}

.card__price {
  font-family: var(--font-heading);
  font-weight: 800;
  color: var(--color-accent);
}

/* ── PAGINATION ─────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: var(--space-2xl);
}

.page-link {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-card);
  box-shadow: var(--shadow-card);
  transition: all .15s;
}

.page-link:hover { border-color: var(--color-accent); color: var(--color-accent); }

.page-link.active {
  background: var(--color-accent);
  color: #fff;
  box-shadow: none;
}

.page-link.disabled {
  opacity: .35;
  pointer-events: none;
}

/* ── BREADCRUMBS ────────────────────── */
.breadcrumbs {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.breadcrumbs a:hover { color: var(--color-accent); text-decoration: underline; }
.breadcrumbs span + span::before {
  content: '/';
  margin: 0 6px;
  opacity: .4;
}

/* ── GALLERY ────────────────────────── */
.gallery { margin-bottom: var(--space-lg); }

.gallery__main {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #E8E6E1;
  margin-bottom: var(--space-sm);
}

.gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__thumbs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
}

.gallery__thumb {
  width: 80px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  opacity: .55;
  transition: opacity .2s, box-shadow .2s;
  flex-shrink: 0;
}

.gallery__thumb:hover { opacity: .8; }
.gallery__thumb.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--color-accent);
}

.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── LISTING HEADER ─────────────────── */
.listing-main { flex: 1; min-width: 0; }

.listing-header { margin-bottom: var(--space-lg); }

.listing-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
}

.listing-meta {
  display: flex;
  gap: var(--space-md);
  font-size: 14px;
  color: var(--color-text-secondary);
}

.listing-price {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 32px;
  color: var(--color-accent);
  margin-top: var(--space-md);
}

/* ── SPECS TABLE ────────────────────── */
.specs {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.specs__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: var(--space-md);
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm) var(--space-xl);
}

.spec-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.spec-label { color: var(--color-text-secondary); }
.spec-value { font-weight: 600; text-align: right; }

/* ── DESCRIPTION ────────────────────── */
.description {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.description__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: var(--space-md);
}

.description__text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text);
}

.description__text p + p { margin-top: var(--space-md); }

/* ── CONTACT CARD ───────────────────── */
.listing-sidebar { width: 300px; flex-shrink: 0; }

.contact-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg);
  position: sticky;
  top: 80px;
}

.contact-seller {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.contact-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), #1A8B79);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.contact-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
}

.contact-since {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.contact-phone {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: var(--space-md);
  letter-spacing: .02em;
}

.btn-call {
  display: block;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .2s, transform .1s;
  margin-bottom: var(--space-sm);
}

.btn-call:hover { background: var(--color-accent-hover); }
.btn-call:active { transform: scale(.98); }

.btn-message {
  display: block;
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}

.btn-message:hover { background: rgba(13,184,164,.08); }

.contact-info {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.contact-info__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

/* ── SIMILAR LISTINGS ───────────────── */
.similar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-2xl);
}

.similar__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: var(--space-lg);
}

/* ── RESPONSIVE ─────────────────────── */
@media (max-width: 1024px) {
  .cards--listings { grid-template-columns: repeat(2, 1fr); }
  .cards--similar { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .header__inner { flex-wrap: wrap; gap: var(--space-md); }

  .page {
    flex-direction: column;
    padding: var(--space-md);
  }

  .sidebar { width: 100%; }
  .filters { position: static; }

  .listing-sidebar { width: 100%; }
  .contact-card { position: static; }

  .specs-grid { grid-template-columns: 1fr; }

  .cards--listings { grid-template-columns: 1fr; gap: var(--space-md); }
  .cards--similar { grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }

  .listing-title { font-size: 22px; }
  .listing-price { font-size: 26px; }
}

@media (max-width: 480px) {
  .cards--similar { grid-template-columns: 1fr; }
}
