/* ─── Camper Nomad Design System v2 ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

/* ─── Variables ─────────────────────────────────────────────────── */
:root {
  --primary:       #2D6A4F;
  --primary-light: #40916C;
  --primary-surf:  #EAF4EF;
  --accent:        #E76F51;
  --accent-surf:   #FEF0EC;
  --bg:            #FAF7F2;
  --surface:       #FFFFFF;
  --text-1:        #1A1A1A;
  --text-2:        #4B5563;
  --text-hint:     #9CA3AF;
  --outline:       #E5E7EB;
  --shadow-card:   0 2px 12px rgba(0,0,0,0.08);
  --shadow-nav:    0 -4px 20px rgba(0,0,0,0.08);
  --shadow-btn:    0 4px 16px rgba(45,106,79,0.32);
  --radius-xl:     20px;
  --radius-lg:     16px;
  --radius-md:     12px;
  --radius-sm:     8px;
  --radius-full:   9999px;
}

/* ─── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
input, textarea, button, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ─── Layout ────────────────────────────────────────────────────── */
.cn-page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}
.cn-page--white { background: var(--surface); }

/* ─── AppBar ────────────────────────────────────────────────────── */
.app-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline);
}
.app-bar--transparent {
  background: transparent; border-bottom: none;
  position: absolute; width: 100%;
}
.app-bar__title { font-size: 17px; font-weight: 700; color: var(--text-1); flex: 1; }
.app-bar__back {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-1);
  transition: opacity .15s;
}
.app-bar__back:active { opacity: .7; }
.app-bar__icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .15s;
}
.app-bar__icon-btn:active { opacity: .7; }

/* ─── Bottom Navigation ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--outline);
  box-shadow: var(--shadow-nav);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  padding: 10px 4px;
  font-size: 11px; font-weight: 700;
  color: var(--text-hint);
  transition: color .15s; position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: ''; position: absolute; bottom: 0;
  width: 20px; height: 3px;
  background: var(--primary); border-radius: 2px 2px 0 0;
}
.nav-item svg { width: 22px; height: 22px; }

/* ─── Cards ─────────────────────────────────────────────────────── */
.cn-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Большая карточка */
.listing-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden; position: relative;
  transition: transform .15s;
}
.listing-card:active { transform: scale(0.99); }

.listing-card__photo {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover; display: block;
  background: var(--primary-surf);
}
.listing-card__photo-ph {
  width: 100%; aspect-ratio: 4/3;
  background: var(--primary-surf);
  display: flex; align-items: center; justify-content: center;
}
.listing-card__overlay-badge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px; font-weight: 700; color: var(--primary);
}
.listing-card__fav {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.listing-card__fav:active { transform: scale(0.88); }
.listing-card__fav.active svg { fill: var(--accent); stroke: var(--accent); }

.listing-card__body { padding: 14px 16px 16px; }
.listing-card__title {
  font-size: 16px; font-weight: 700; color: var(--text-1);
  margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.listing-card__meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-hint); margin-bottom: 12px;
}
.listing-card__rating {
  display: flex; align-items: center; gap: 3px;
  font-weight: 700; color: var(--text-2);
}
.star { color: #FBBF24; font-size: 13px; }
.listing-card__price-row {
  display: flex; align-items: center; justify-content: space-between;
}
.price { font-size: 20px; font-weight: 800; color: var(--accent); }
.price-sm { font-size: 16px; font-weight: 800; color: var(--accent); }
.price-unit { font-size: 13px; color: var(--text-hint); }

/* Маленькая карточка */
.listing-card-sm {
  width: 172px; flex-shrink: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden; position: relative;
  transition: transform .15s;
}
.listing-card-sm:active { transform: scale(0.97); }
.listing-card-sm__photo {
  width: 100%; height: 120px;
  object-fit: cover; display: block;
  background: var(--primary-surf);
}
.listing-card-sm__photo-ph {
  width: 100%; height: 120px;
  background: var(--primary-surf);
  display: flex; align-items: center; justify-content: center;
}
.listing-card-sm__body { padding: 10px 12px 12px; }
.listing-card-sm__title {
  font-size: 13px; font-weight: 600; color: var(--text-1);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px; line-height: 1.4;
}
.listing-card-sm__price { font-size: 15px; font-weight: 800; color: var(--accent); }
.listing-card-sm__city { font-size: 11px; color: var(--text-hint); margin-top: 2px; }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; border-radius: var(--radius-lg);
  font-size: 15px; font-weight: 700; width: 100%;
  transition: transform .12s, box-shadow .12s, opacity .12s;
  position: relative;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:active { box-shadow: none; }
.btn-secondary { background: var(--surface); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(231,111,81,.32); }
.btn-ghost { background: transparent; color: var(--primary); height: 44px; }
.btn-ghost-red { background: transparent; color: #DC2626; height: 44px; }
.btn-sm { height: 40px; font-size: 13px; border-radius: var(--radius-md); }
.btn-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); flex-shrink: 0; transition: opacity .15s;
}
.btn-icon:active { opacity: .7; }

/* ─── Inputs ────────────────────────────────────────────────────── */
.cn-input {
  width: 100%; height: 52px; padding: 0 16px;
  border-radius: var(--radius-lg); border: 1.5px solid var(--outline);
  background: var(--surface); font-size: 15px; color: var(--text-1);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.cn-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,106,79,.12); }
.cn-input::placeholder { color: var(--text-hint); }
textarea.cn-input { height: auto; padding: 14px 16px; resize: none; line-height: 1.5; }
.cn-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }

/* Поисковая строка */
.search-bar {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 2px 16px rgba(0,0,0,.10);
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 52px; cursor: pointer;
}
.search-bar__icon { color: var(--primary); flex-shrink: 0; }
.search-bar__text { flex: 1; color: var(--text-hint); font-size: 14px; font-weight: 600; }

/* ─── Category Chips ────────────────────────────────────────────── */
.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 700; white-space: nowrap;
  transition: all .18s; border: 1.5px solid var(--outline);
  background: var(--surface); color: var(--text-2); flex-shrink: 0;
}
.cat-chip.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(45,106,79,.28);
}

/* ─── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
}
.badge--pending   { background: #FEF3C7; color: #92400E; }
.badge--payment   { background: #FEF3C7; color: #92400E; }
.badge--paid      { background: #DBEAFE; color: #1E40AF; }
.badge--confirmed { background: #D1FAE5; color: #065F46; }
.badge--completed { background: #F3F4F6; color: #374151; }
.badge--cancelled { background: #FEE2E2; color: #991B1B; }
.badge--disputed  { background: #FEE2E2; color: #991B1B; }
.cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-surf); color: var(--primary);
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
}

/* ─── Section Headers ───────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; margin-bottom: 12px;
}
.section-title { font-size: 18px; font-weight: 800; color: var(--text-1); }
.section-link { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ─── Scroll ────────────────────────────────────────────────────── */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }

/* ─── Skeleton ──────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #F0EDEA 25%, #E4E1DD 50%, #F0EDEA 75%);
  background-size: 400% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ─── Bottom Sheet ──────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0);
  z-index: 100; transition: background .3s; pointer-events: none;
}
.overlay.visible { background: rgba(0,0,0,.45); pointer-events: all; }
.bottom-sheet {
  position: fixed; bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 480px;
  background: var(--surface); border-radius: 24px 24px 0 0;
  z-index: 101; transition: transform .35s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom, 16px);
  max-height: 90dvh; overflow-y: auto;
}
.bottom-sheet.open { transform: translateX(-50%) translateY(0); }
.bottom-sheet__handle {
  width: 36px; height: 4px; background: var(--outline);
  border-radius: 2px; margin: 12px auto 20px;
}

/* ─── Toast ─────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 448px;
  z-index: 200; pointer-events: none;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 14px 16px; border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 600; color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  animation: toast-in .25s ease-out; pointer-events: all;
}
.toast--success { background: var(--primary); }
.toast--error   { background: #DC2626; }
.toast--info    { background: #1F2937; }
@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Promo Banner ──────────────────────────────────────────────── */
.promo-banner {
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #2D6A4F 0%, #52B788 100%);
  padding: 22px 20px; position: relative; overflow: hidden;
}
.promo-banner::after {
  content: '🏕️'; position: absolute;
  right: 20px; top: 50%; transform: translateY(-50%);
  font-size: 64px; opacity: 0.2;
}

/* ─── Tabs ──────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 1.5px solid var(--outline); }
.tab {
  flex: 1; text-align: center; padding: 12px 8px;
  font-size: 14px; font-weight: 700; color: var(--text-hint);
  position: relative; transition: color .15s;
}
.tab.active { color: var(--primary); }
.tab.active::after {
  content: ''; position: absolute; bottom: -1.5px; left: 16%; right: 16%;
  height: 2.5px; background: var(--primary); border-radius: 2px;
}

/* ─── Stepper ───────────────────────────────────────────────────── */
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper__btn {
  width: 40px; height: 40px; border-radius: var(--radius-full);
  border: 2px solid var(--primary); color: var(--primary);
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.stepper__btn:active { background: var(--primary); color: #fff; }
.stepper__val { font-size: 20px; font-weight: 800; min-width: 32px; text-align: center; }

/* ─── Chat ──────────────────────────────────────────────────────── */
.msg-out { background: var(--primary); color: #fff; border-radius: 18px 18px 4px 18px; align-self: flex-end; }
.msg-in  { background: var(--surface); color: var(--text-1); border-radius: 18px 18px 18px 4px; align-self: flex-start; box-shadow: var(--shadow-card); }

/* ─── OTP Inputs ────────────────────────────────────────────────── */
.otp-inputs { display: flex; gap: 12px; justify-content: center; }
.otp-input {
  width: 60px; height: 64px; border-radius: var(--radius-lg);
  border: 2px solid var(--outline); background: var(--surface);
  text-align: center; font-size: 26px; font-weight: 800; color: var(--text-1);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,106,79,.12); }
.otp-input.filled { border-color: var(--primary); background: var(--primary-surf); }

/* ─── Price Rows ────────────────────────────────────────────────── */
.price-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.price-row + .price-row { margin-top: 8px; }
.price-row--total { font-size: 16px; font-weight: 800; }
.price-row--total .pr-val { color: var(--accent); }

/* ─── Amenity ───────────────────────────────────────────────────── */
.amenity-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); padding: 6px 0; }
.amenity-item__icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--primary-surf); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 15px;
}

/* ─── Gallery ───────────────────────────────────────────────────── */
.gallery { position: relative; overflow: hidden; }
.gallery__track { display: flex; transition: transform .35s cubic-bezier(0.4,0,0.2,1); }
.gallery__slide { min-width: 100%; }
.gallery__slide img { width: 100%; height: 280px; object-fit: cover; background: var(--primary-surf); }
.gallery__dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.gallery__dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); transition: all .2s; }
.gallery__dot.active { background: #fff; width: 18px; border-radius: 3px; }
.gallery__counter {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,.45); color: #fff;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: var(--radius-full);
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 32px; gap: 12px; }
.empty-state__icon { font-size: 56px; line-height: 1; }
.empty-state__title { font-size: 17px; font-weight: 700; }
.empty-state__text  { font-size: 14px; color: var(--text-hint); line-height: 1.5; }

/* ─── Utilities ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--outline); }
.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-hint    { color: var(--text-hint); }
.text-2       { color: var(--text-2); }
.font-800     { font-weight: 800; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-nav       { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
.safe-bottom  { padding-bottom: env(safe-area-inset-bottom, 16px); }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .listing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 0 16px; }
}
@media (min-width: 1024px) {
  .listing-grid { grid-template-columns: repeat(4, 1fr); }
  .cn-page { max-width: 1040px; }
  .bottom-nav { display: none; }
}
