@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent: #00aaff;
  --accent-dark: #0095e0;
  --text: #1a1a1a;
  --muted: #757575;
  --border: #e5e5e5;
  --bg-soft: #f7f7f7;
  --danger: #ff4053;
  --header-h: 64px;
}

* { box-sizing: border-box; }

/* Стрелка select — с отступом от правого края, как текст слева */
select:not([multiple]):not([size]) {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-height: 42px;
  line-height: 1.35;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%23757575' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px auto;
  cursor: pointer;
}

body {
  margin: 0;
  font: 15px/1.45 Inter, system-ui, sans-serif;
  color: var(--text);
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== HEADER ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.site-header__row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--header-h);
  flex-wrap: wrap;
  padding: 8px 0;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  text-decoration: none !important;
  white-space: nowrap;
}
.site-logo--img { padding: 4px 0; }
.site-logo__img,
.irr-logo--header {
  display: block;
  max-height: 42px;
  width: auto;
  object-fit: contain;
  background: transparent;
}
.site-search {
  flex: 1 1 320px;
  display: flex;
  min-width: 200px;
}
.site-search input[type="search"],
.site-search input[type="text"] {
  flex: 1;
  border: 2px solid var(--accent);
  border-radius: 8px 0 0 8px;
  padding: 10px 14px;
  font: inherit;
  outline: none;
}
.site-search select {
  border: 2px solid var(--accent);
  border-left: 0;
  padding: 10px 2.5rem 10px 8px;
  font: inherit;
  max-width: 160px;
  background-color: #fff;
}
.site-search button {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font: inherit;
  text-decoration: none !important;
}
.btn--primary {
  background: var(--accent);
  color: #fff !important;
}
.btn--primary:hover { background: var(--accent-dark); }
.btn--ghost {
  background: var(--bg-soft);
  color: var(--text) !important;
}
.btn--danger { background: var(--danger); color: #fff !important; }

.nav-cats {
  border-top: 1px solid var(--border);
  background: #fff;
  overflow-x: auto;
}
.nav-cats__list {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex-wrap: nowrap;
}
.nav-cats__list a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}
.nav-cats__list a:hover {
  background: var(--bg-soft);
  text-decoration: none;
}

/* ===== MAIN ===== */
.site-main { flex: 1; padding: 24px 0 48px; }

.hero {
  background: linear-gradient(120deg, #e8f6ff, #f0f9ff 45%, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  margin-bottom: 28px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 32px);
}
.hero p { margin: 0; color: var(--muted); max-width: 640px; }

.section-title {
  font-size: 22px;
  margin: 0 0 16px;
  font-weight: 700;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  gap: 12px;
}
.section-head h2 { margin: 0; font-size: 22px; }

/* Category tiles */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.cat-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  color: var(--text);
  background: #fff;
  transition: box-shadow .15s, border-color .15s;
}
.cat-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,170,255,.12);
  text-decoration: none;
}
.cat-tile__name { font-weight: 600; font-size: 14px; }
.cat-tile__count { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Listings grid (Avito-style cards) */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.ad-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s;
}
.ad-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.ad-card__body {
  color: inherit;
  text-decoration: none;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ad-card__body:hover {
  text-decoration: none;
}
.ad-card__img-link {
  display: block;
  width: 100%;
  height: 100%;
}
.ad-card__img {
  position: relative;
  aspect-ratio: 4/3;
  background: #fff;
  overflow: hidden;
}
.ad-card__img--gallery,
.premium-card__media--gallery {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.ad-card__img--gallery::before,
.premium-card__media--gallery::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  max-height: 76px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 2;
}
.ad-card__img--gallery:hover::before,
.ad-card__img--gallery.is-gallery-hover::before,
.premium-card__media--gallery:hover::before,
.premium-card__media--gallery.is-gallery-hover::before {
  opacity: 1;
}
.ad-card__img--gallery.is-swiping,
.premium-card__media--gallery.is-swiping {
  cursor: grabbing;
}
.ad-card__img--gallery .ad-card__photo,
.premium-card__media--gallery .premium-card__photo {
  transition: transform 0.12s ease-out;
  will-change: transform;
}
.ad-card__story-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  display: flex;
  gap: 4px;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.ad-card__img--gallery:hover .ad-card__story-bar,
.ad-card__img--gallery.is-gallery-hover .ad-card__story-bar,
.premium-card__media--gallery:hover .ad-card__story-bar,
.premium-card__media--gallery.is-gallery-hover .ad-card__story-bar {
  opacity: 1;
  transform: translateY(0);
}
@media (hover: none) {
  .ad-card__story-bar {
    opacity: 1;
    transform: none;
  }
}
.ad-card__story-seg {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.ad-card__story-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #fff;
  transition: width 0.18s ease-out;
}
.ad-card__story-seg.is-done .ad-card__story-fill {
  width: 100%;
}
.is-gallery-hover .ad-card__story-seg.is-current .ad-card__story-fill {
  width: 0;
  animation: ad-card-story-fill 1.2s linear forwards;
}
.ad-card__story-seg.is-current .ad-card__story-fill {
  width: 100%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.45);
}
@keyframes ad-card-story-fill {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}
.ad-card__img .irr-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.irr-photo--placeholder {
  object-fit: contain;
  background: #fff;
}
.listing-gallery-main .irr-photo--placeholder {
  object-fit: contain;
  background: #fff;
  max-height: 520px;
}
.ad-card__body { padding: 12px; gap: 4px; }
.ad-card__price {
  font-size: 18px;
  font-weight: 700;
}
.ad-card__title {
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ad-card__meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
  padding-top: 8px;
}

/* Listing detail */
.listing-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .listing-layout { grid-template-columns: 1fr; }
}
.listing-gallery {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-soft);
  min-height: 280px;
  background-size: cover;
  background-position: center;
}
.listing-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.listing-thumbs__item {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 2px solid transparent;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  padding: 0;
}
.listing-thumbs__item.is-active {
  border-color: #00aaff;
}
.listing-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.listing-price {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 12px;
}
.listing-attrs {
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.listing-attrs__row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.listing-attrs__row:last-child { border-bottom: 0; }
.listing-attrs__row:nth-child(odd) { background: #fafafa; }
.listing-attrs__row dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}
.listing-attrs__row dd {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}
.listing-title { font-size: 22px; margin: 0 0 16px; }
.listing-desc { white-space: pre-wrap; line-height: 1.55; color: #333; }
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--muted); }

/* Forms */
.form-card {
  max-width: 640px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.form-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.form-card input,
.form-card textarea,
.form-card select {
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.form-card select {
  padding: 10px 2.5rem 10px 12px;
}
.form-card textarea { min-height: 120px; resize: vertical; }

.empty-state {
  text-align: center;
  padding: 40px 20px 48px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.empty-state__img {
  display: block;
  width: min(200px, 55vw);
  height: auto;
  margin: 0 auto 16px;
  object-fit: contain;
}
.empty-state__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.empty-state__text a {
  color: #00aaff;
  font-weight: 600;
  text-decoration: none;
}
.empty-state__text a:hover {
  color: #0095e0;
  text-decoration: underline;
}

/* ===== FOOTER ===== */
.site-footer {
  background: #2b2b2b;
  color: #c8c8c8;
  margin-top: auto;
  padding: 40px 0 24px;
  font-size: 14px;
}
.site-footer a { color: #e0e0e0; }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}
.footer-grid h3 {
  color: #fff;
  font-size: 14px;
  margin: 0 0 12px;
}
.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { text-decoration: none; font-size: 13px; }
.footer-bottom {
  border-top: 1px solid #444;
  padding-top: 16px;
  font-size: 12px;
  color: #999;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}
