/**
 * OLAI — основные стили
 */

:root {
  --green: #00A859;
  --orange: #FF6B35;
  --bg: #F4F4F2;
  --header-height: 56px;
  --primary: var(--green);
  --body-bg: var(--bg);
  --text: #1A1A1A;
  --card-bg: #FFFFFF;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--body-bg);
  color: var(--text);
  padding-bottom: 0;
}

.main-content {
  min-height: calc(100vh - var(--header-height));
}

.main-content__spacer {
  height: 72px;
}

/* ========== Header ========== */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.header-nav .header-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: var(--header-height);
}

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--green);
  flex-shrink: 0;
}

.header-logo:hover {
  color: var(--green);
  opacity: 0.9;
}

.header-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}

.header-search__form {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search__form:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.15);
}

.header-search__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  outline: none;
}

.header-search__btn {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.header-search__btn:hover {
  background: #008f4a;
  color: #fff;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  border: 1px solid transparent;
}

.header-btn--outline {
  color: var(--text);
  border-color: #ddd;
  background: var(--card-bg);
}

.header-btn--outline:hover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(0, 168, 89, 0.05);
}

.header-btn--primary {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.header-btn--primary:hover {
  background: #e85a2a;
  color: #fff;
  border-color: #e85a2a;
}

/* ========== Bottom nav (mobile) ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1030;
  padding: 0.5rem 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.bottom-nav__container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 100%;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #6c757d;
  text-decoration: none;
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
  transition: color 0.2s;
}

.bottom-nav__item .bi {
  font-size: 1.35rem;
  margin-bottom: 0.2rem;
}

.bottom-nav__item.active,
.bottom-nav__item:hover {
  color: var(--green);
}

.bottom-nav__item--primary {
  color: var(--orange);
}

.bottom-nav__item--primary:hover {
  color: #e85a2a;
}

/* ========== Cards & animations ========== */
.card-style {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card-style:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.5s ease forwards;
}

/* ========== Home: Hero ========== */
.hero {
  background: var(--green);
  color: #fff;
  padding: 2.5rem 1rem 3rem;
}

.hero__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.hero__subtitle {
  opacity: 0.95;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.hero-search {
  display: flex;
  max-width: 560px;
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero-search__input {
  flex: 1;
  border: none;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  outline: none;
}

.hero-search__btn {
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s;
}

.hero-search__btn:hover {
  background: #e85a2a;
  color: #fff;
}

/* ========== Home: Sections ========== */
.section {
  padding: 2rem 0;
}

.section__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: #1a1a1a;
}

.section__more {
  text-align: center;
  margin-top: 1.5rem;
}

/* ========== Categories grid (5 columns) ========== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

@media (max-width: 992px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 576px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Остальные категории (slideDown) */
.categories-more {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.categories-more.is-open {
  max-height: 2500px;
}

.categories-more .categories-grid {
  margin-top: 1rem;
}

.categories-toggle-wrap {
  text-align: center;
  margin-top: 1rem;
}

.categories-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  font-size: 0.95rem;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.categories-toggle-btn:hover {
  background: var(--green);
  color: #fff;
}

.category-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.25rem;
  text-decoration: none;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.category-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  color: #1a1a1a;
}

.category-card__icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.category-card__icon-wrap--1 { background: #e8f5e9; }
.category-card__icon-wrap--2 { background: #e3f2fd; }
.category-card__icon-wrap--3 { background: #fff3e0; }
.category-card__icon-wrap--4 { background: #fce4ec; }
.category-card__icon-wrap--5 { background: #f3e5f5; }
.category-card__icon-wrap--6 { background: #e0f7fa; }
.category-card__icon-wrap--7 { background: #e8eaf6; }
.category-card__icon-wrap--8 { background: #efebe9; }

.category-card__icon {
  font-size: 1.75rem;
}

.category-card__name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.category-card__count {
  font-size: 0.8rem;
  color: #666;
}

/* ========== Promo banner ========== */
.promo-banner {
  background: var(--card-bg);
  color: var(--text);
  border-radius: 14px;
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.promo-banner__title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.promo-banner__text {
  opacity: 0.9;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  color: #666;
}

.promo-banner__btn {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  padding: 0.6rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.promo-banner__btn:hover {
  background: #e85a2a;
  color: #fff;
}

/* ========== Listings grid (4 columns) ========== */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 992px) {
  .listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .listings-grid {
    grid-template-columns: 1fr;
  }
}

/* Listing card (home & global) */
.listing-card {
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.listing-card:hover,
.listing-card-link:hover .listing-card {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.listing-card__image {
  position: relative;
  aspect-ratio: 4/3;
  background: #eee;
  overflow: hidden;
}

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

.listing-card__no-image {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
}

.listing-card__no-image .bi {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.listing-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
}

.listing-card__image-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.listing-card__content {
  padding: 1rem;
}

.listing-card__price {
  font-weight: 700;
  font-size: 1.2rem;
  color: #1a1a1a;
  margin-bottom: 0.35rem;
}

.listing-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.35rem 0;
  line-height: 1.35;
  color: #1a1a1a;
}

.listing-card__description {
  font-size: 0.85rem;
  color: #666;
  margin: 0.25rem 0;
}

.listing-card__location {
  font-size: 0.85rem;
  color: #666;
}

.listing-card__location .bi {
  margin-right: 0.25rem;
}

.listing-card__meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #888;
}

/* Pagination */
.pagination-container {
  margin: 2rem 0;
}

/* Header: имя пользователя */
.header-user-name {
  font-size: 0.9rem;
  color: var(--text);
  margin-right: 0.25rem;
}

/* ========== Auth (login / register) ========== */
.auth-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  padding: 2rem;
}

.auth-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.auth-form__group {
  margin-bottom: 1rem;
}

.auth-form__label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.auth-form__input {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.auth-form__input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.12);
}

.auth-form__error {
  display: block;
  font-size: 0.85rem;
  color: #c00;
  margin-top: 0.25rem;
}

.auth-form__btn {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.auth-form__btn--primary {
  background: var(--green);
  color: #fff;
}

.auth-form__btn--primary:hover {
  background: #008f4a;
  color: #fff;
}

.auth-card__footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  color: #666;
}

.auth-card__footer a {
  color: var(--green);
  font-weight: 500;
}

.auth-card__footer a:hover {
  text-decoration: underline;
}

/* Dark theme: светлая страница и карточки, тёмный хедер */
[data-theme="dark"] {
  --body-bg: #F4F4F2;
}

[data-theme="dark"] body {
  background-color: var(--body-bg);
  color: var(--text);
}

[data-theme="dark"] .listing-card,
[data-theme="dark"] .category-card,
[data-theme="dark"] .promo-banner {
  background: #FFFFFF;
}

[data-theme="dark"] .listing-card__price,
[data-theme="dark"] .listing-card__title,
[data-theme="dark"] .section__title {
  color: var(--text);
}

/* Хедер оставляем тёмным */
[data-theme="dark"] .site-header,
[data-theme="dark"] .bottom-nav {
  background: #252525;
  border-color: #333;
}

/* ========== Мобильная полировка ========== */

/* Карточки в 2 колонки на мобильном */
@media (max-width: 575px) {
  .listings-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: .5rem !important;
  }
  .listing-card__title { font-size: .8rem; }
  .listing-card__price { font-size: .85rem; }
  .listing-card__description { display: none; }
  .listing-card__content { padding: .5rem; }
  .listing-card__image { aspect-ratio: 1/1; }

  /* Меньше отступы у контейнера */
  .container { padding-left: .75rem; padding-right: .75rem; }

  /* Галерея на мобильном */
  .gallery-thumb { width: 56px; height: 44px; }
}

/* Bottom nav — всегда виден на мобильном */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: var(--card-bg);
  border-top: 1px solid rgba(0,0,0,.1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav__container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 58px;
  max-width: 600px;
  margin: 0 auto;
}
.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: .65rem;
  color: #666;
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: .5rem;
  transition: color .15s;
  position: relative;
}
.bottom-nav__item i { font-size: 1.35rem; }
.bottom-nav__item.active,
.bottom-nav__item:hover { color: var(--green); }
.bottom-nav__item--primary {
  background: var(--green);
  color: #fff !important;
  border-radius: .75rem;
  padding: .35rem .9rem;
}
.bottom-nav__item--primary i { font-size: 1.5rem; }
.bottom-nav__item--primary:hover { background: #009050; }

/* Отступ для мобильного footer */
@media (max-width: 991px) {
  .main-content { padding-bottom: 70px; }
}

/* Форматирование price_fmt */
.price-formatted { white-space: nowrap; }

/* Пустые состояния */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: #888;
}
.empty-state__icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state__title { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; color: #555; }
.empty-state__text { font-size: .9rem; margin-bottom: 1.5rem; }
