:root { --bs-body-bg: #f5f6f8; --radius: 14px; }
body { background: var(--bs-body-bg); }
main { min-height: 70vh; }
.nav-icon { color: #333; text-decoration: none; font-size: 1.15rem; }
.nav-icon:hover { color: var(--bs-primary); }
.top-bar .unread-badge { font-size: .65rem; position: relative; top: -8px; left: -4px; }
.card { border: 0; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.min-w-0 { min-width: 0; }

/* Категории */
.category-strip { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.cat-chip { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .45rem .9rem; border-radius: 999px; background: #fff; color: #333; text-decoration: none; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.cat-chip:hover { color: var(--bs-primary); }
.cat-chip.active { background: var(--bs-primary); color: #fff; }

/* Карточки */
.listing-card { overflow: hidden; transition: transform .12s, box-shadow .12s; position: relative; }
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.09); }
.card-img-wrap { background: #eef0f3; display: block; }
.card-img-wrap img { object-fit: cover; }
.no-photo { display: flex; align-items: center; justify-content: center; color: #b5bac3; font-size: 2.5rem; }
.listing-card .price { font-weight: 700; font-size: 1.05rem; }
.listing-card .title { color: #222; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.listing-card .meta { color: #8a8f98; font-size: .8rem; margin-top: .25rem; }
.card-badge { position: absolute; top: .6rem; left: .6rem; z-index: 2; }
.fav-form { position: absolute; top: .5rem; right: .5rem; z-index: 3; }
.fav-btn { border: 0; background: rgba(255,255,255,.9); border-radius: 50%; width: 34px; height: 34px; color: #c5c9d0; display: flex; align-items: center; justify-content: center; }
.fav-btn:hover { color: #e35d6a; }
.fav-btn.active { color: #dc3545; }

.empty-state { text-align: center; padding: 4rem 1rem; color: #6c757d; }
.empty-state > i { font-size: 3rem; display: block; margin-bottom: .5rem; color: #c5c9d0; }

/* Объявление */
.gallery { background: #eef0f3; border-radius: var(--radius); overflow: hidden; }
.gallery .carousel-item img { width: 100%; height: 460px; object-fit: contain; }
.gallery-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .8; }
.gallery-thumb:hover { opacity: 1; }
.no-photo-lg { background: #eef0f3; border-radius: var(--radius); height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #b5bac3; font-size: 3rem; }
.no-photo-lg div { font-size: 1rem; }
.display-price { font-size: 1.9rem; font-weight: 700; }
.side-card { top: 80px; }
.description { white-space: normal; font-size: 1.02rem; }
.contacts li { margin-bottom: .35rem; }
.contacts i { color: #8a8f98; width: 1.2rem; display: inline-block; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.avatar-initials { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); display: flex; align-items: center; justify-content: center; font-weight: 600; }

/* Форма подачи */
.step { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; font-weight: 600; }
.step span { background: var(--bs-primary); color: #fff; border-radius: 50%; width: 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; }
.dropzone { display: block; border: 2px dashed #ccd1d9; border-radius: var(--radius); padding: 1.75rem; text-align: center; cursor: pointer; color: #6c757d; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone.drag { background: #eef4ff; border-color: var(--bs-primary); }
.preview-item { position: relative; }
.preview-item img, .existing-photo img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.preview-item button { position: absolute; top: -8px; right: -8px; border: 0; border-radius: 50%; width: 22px; height: 22px; background: #dc3545; color: #fff; font-size: .75rem; line-height: 1; }
.preview-item .cover-label { position: absolute; bottom: 2px; left: 2px; background: rgba(0,0,0,.6); color: #fff; font-size: .65rem; padding: 0 4px; border-radius: 4px; }
.existing-photo { text-align: center; cursor: pointer; }

/* Мои объявления */
.my-thumb { width: 88px; height: 66px; border-radius: 8px; overflow: hidden; background: #eef0f3; display: flex; align-items: center; justify-content: center; color: #b5bac3; flex-shrink: 0; }
.my-thumb img { width: 100%; height: 100%; object-fit: cover; }
.small-thumb { width: 56px; height: 44px; }

/* Сообщения */
.list-group-item.unread { background: #f1f6ff; }
.chat { max-width: 820px; margin: 0 auto; }
.chat-body { height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: .35rem; background: #f8f9fb; }
.chat-day { align-self: center; font-size: .75rem; color: #8a8f98; background: #eceff3; border-radius: 999px; padding: .1rem .7rem; margin: .5rem 0; }
.bubble { max-width: 75%; padding: .5rem .8rem; border-radius: 14px; word-wrap: break-word; }
.bubble.mine { align-self: flex-end; background: var(--bs-primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06); border-bottom-left-radius: 4px; }
.bubble-time { font-size: .7rem; opacity: .7; text-align: right; }
#chat-form textarea { resize: none; }

.auth-card { max-width: 420px; }


/* ================= Мобильная версия ================= */
:root { --bottom-nav-h: 60px; --safe-b: env(safe-area-inset-bottom, 0px); }

/* Нижняя панель навигации */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--bottom-nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #fff; border-top: 1px solid #e5e7eb; box-shadow: 0 -2px 10px rgba(0,0,0,.04);
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #6b7280; text-decoration: none; font-size: .68rem; position: relative; -webkit-tap-highlight-color: transparent; }
.bottom-nav a i { font-size: 1.35rem; line-height: 1; }
.bottom-nav a.active { color: var(--bs-primary); }
.bottom-nav a.add i { background: var(--bs-success); color: #fff; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-top: -14px; box-shadow: 0 3px 8px rgba(25,135,84,.35); font-size: 1.4rem; }
.bottom-nav .unread-badge { position: absolute; top: 6px; left: 50%; margin-left: 6px; background: #dc3545; color: #fff;
  font-size: .62rem; font-weight: 600; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.bottom-nav .unread-badge.d-none { display: none !important; }

/* Нижняя панель действий (объявление, форма) */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem calc(.6rem + var(--safe-b));
  background: #fff; border-top: 1px solid #e5e7eb; box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}
.action-bar .btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.action-price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; margin-right: auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }

/* Шторка снизу (меню, фильтры) */
.sheet.offcanvas-bottom { height: auto; max-height: 85vh; border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); }
.sheet-handle { width: 40px; height: 5px; background: #d1d5db; border-radius: 3px; margin: 10px auto 12px; }
.menu-list li { border-bottom: 1px solid #f1f2f4; }
.menu-list li:last-child, .menu-list li:has(hr), .menu-list li:first-child { border-bottom: 0; }
.menu-list hr { display: none; }
.menu-link { display: block; width: 100%; text-align: left; padding: .85rem .25rem; color: #222; text-decoration: none; background: none; border: 0; font-size: 1.02rem; }
.menu-link i { color: #6b7280; }

.mobile-price { font-size: 1.6rem; font-weight: 700; }

@media (max-width: 991.98px) {
  body { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 8px); }
  body.has-action-bar { padding-bottom: calc(76px + var(--safe-b)); }
  .top-bar { padding-top: .4rem; padding-bottom: .4rem; }
  .top-bar .navbar-brand { font-size: 1.35rem; }
  .top-search .form-control { border-left: 0; }
  .side-card { position: static; }
  .filter-card { box-shadow: none; padding-top: 0; }
  #filters.offcanvas-bottom .filter-card { border-radius: 0; }
  .feed-title { font-size: 1.1rem; }
  .feed-tools { width: 100%; }
  .feed-tools select { flex: 1; }
  .empty-state { padding: 2.5rem 1rem; }
  .chat-page .top-bar { display: none; }
  .chat-page main { padding: 0 !important; max-width: none; }
  .chat-page .chat { border-radius: 0; height: 100dvh; display: flex; flex-direction: column; }
  .chat-page .chat-body { flex: 1; height: auto; }
  .chat-page .card-footer { padding-bottom: calc(.5rem + var(--safe-b)); }
  .chat-page .form-text { display: none; }
}

@media (max-width: 575.98px) {
  .brand-text { display: none; }
  main.container { padding-left: 12px; padding-right: 12px; }
  .row.g-3 { --bs-gutter-x: .6rem; --bs-gutter-y: .6rem; }
  .listing-card .card-body { padding: .55rem .65rem .7rem !important; }
  .listing-card .price { font-size: .98rem; }
  .listing-card .title { font-size: .88rem; }
  .listing-card .meta { font-size: .72rem; }
  .card-badge { font-size: .65rem; }
  .fav-btn { width: 30px; height: 30px; font-size: .85rem; }
  .cat-chip { padding: .4rem .75rem; font-size: .9rem; }
  .category-strip { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; scrollbar-width: none; }
  .category-strip::-webkit-scrollbar { display: none; }
  /* Фото во всю ширину экрана */
  .gallery { margin-left: -12px; margin-right: -12px; border-radius: 0; }
  .gallery .carousel-item img { height: 300px; }
  .carousel-control-prev, .carousel-control-next { display: none; }
  .no-photo-lg { height: 180px; }
  .listing-title { font-size: 1.2rem; }
  .bubble { max-width: 85%; }
  .my-row .card-body { gap: .6rem !important; }
  .my-row form { width: 100%; }
  .my-row form .btn { flex: 1 1 auto; }
  .kind-switch label { padding-top: .75rem !important; padding-bottom: .75rem !important; }
  .card.card-body { padding: 1rem; }
  .auth-card { box-shadow: none; background: transparent; }
  .breadcrumb { display: none; }
  /* 16px — чтобы iPhone не увеличивал страницу при фокусе на поле */
  input.form-control, select.form-select, textarea.form-control { font-size: 16px; }
  .nav-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-tabs .nav-link { white-space: nowrap; }
}

/* Внутри Android-приложения */
.in-app footer { display: none !important; }
@media (hover: none) {
  .listing-card:hover { transform: none; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
  .btn, a, button { -webkit-tap-highlight-color: transparent; }
}

/* Вход через Google */
.btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; border: 1px solid #dadce0; color: #3c4043; font-weight: 500; min-height: 44px; }
.btn-google:hover { background: #f8f9fa; border-color: #c6c9cc; color: #202124; }
.divider-text { display: flex; align-items: center; gap: .75rem; color: #8a8f98; font-size: .85rem; margin: 1rem 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; border-top: 1px solid #e5e7eb; }
