/* StudentSwap — тёплая палитра (крем / терракота / мёд) */

:root {
  --bg: #f7f0e6;
  --bg2: #fffaf2;
  --card: #fffdf8;
  --text: #3b2f24;
  --hint: #a18a74;
  --accent: #d96f32;          /* терракота */
  --accent-deep: #b85a24;
  --accent-soft: #f9e4d2;     /* тёплый персиковый фон */
  --accent-text: #ffffff;
  --honey: #e8a94b;           /* медовый — акценты, звёзды */
  --success: #7d9b52;
  --danger: #c9503e;
  --line: #eadfce;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(105, 70, 35, .10);
}

body[data-theme="dark"] {
  --bg: #241c14;
  --bg2: #2e241a;
  --card: #332920;
  --text: #f1e6d8;
  --hint: #a9927b;
  --accent: #e0803f;
  --accent-deep: #f09455;
  --accent-soft: #453325;
  --accent-text: #fff8f0;
  --honey: #e8a94b;
  --success: #96b06e;
  --danger: #e06a58;
  --line: #46372a;
  --shadow: 0 1px 5px rgba(0, 0, 0, .35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }

.ic { vertical-align: -0.22em; flex-shrink: 0; }

/* Шапка */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--honey));
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-tagline { font-size: 11px; color: var(--hint); }

.icon-btn {
  position: relative; background: none; border: none;
  cursor: pointer; padding: 8px; color: var(--text);
  border-radius: 12px;
}
.icon-btn:active { background: var(--accent-soft); }
.icon-btn.has-unread { color: var(--accent); }
@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  35% { transform: rotate(-12deg); }
  55% { transform: rotate(8deg); }
  75% { transform: rotate(-5deg); }
}
.icon-btn.ring .ic { animation: bell-ring 0.9s ease; transform-origin: 50% 15%; }
.badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Контент */
main { flex: 1; padding: 12px 12px 84px; }

/* Поиск и фильтры */
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-wrap { position: relative; flex: 1; }
.search-wrap .ic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--hint); pointer-events: none;
}
.search-input {
  width: 100%; padding: 11px 14px 11px 40px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--text); font-size: 15px;
}
.search-input::placeholder { color: var(--hint); }
.search-input:focus { outline: none; border-color: var(--accent); }

.filter-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 46px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--accent); cursor: pointer;
}
.filter-btn .badge { top: -5px; right: -5px; background: var(--accent); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13px; cursor: pointer;
}
.chip .ic { color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.active .ic { color: var(--accent-text); }
.chip-sub { background: var(--accent-soft); border-color: transparent; }
.chip-sub.active { background: var(--accent-deep); color: var(--accent-text); }

/* Карточки объявлений */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); cursor: pointer;
  display: flex; gap: 12px;
}
.card-photo {
  width: 84px; height: 84px; border-radius: 10px; object-fit: cover;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.card-body { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-price { font-weight: 700; color: var(--accent-deep); font-size: 14px; margin-bottom: 4px; }
.card-meta {
  font-size: 12px; color: var(--hint);
  display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: center;
}
.card-meta .ic { color: var(--hint); }
.card-fav {
  background: none; border: none; cursor: pointer; align-self: flex-start;
  color: var(--hint); padding: 2px;
}
.card-fav.on { color: var(--danger); }
.card-fav.on .ic { fill: currentColor; }

.verified { color: var(--success); font-weight: 600; white-space: nowrap; }
.verified .ic { color: var(--success); }

.empty { text-align: center; color: var(--hint); padding: 44px 20px; line-height: 1.5; }
.empty .big { color: var(--accent); margin-bottom: 10px; }

/* Нижняя навигация */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: var(--bg2);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; border: none; background: none; cursor: pointer;
  font-size: 10px; color: var(--hint);
}
.nav-btn.active { color: var(--accent); font-weight: 600; }
.nav-add span {
  background: linear-gradient(135deg, var(--accent), var(--honey));
  color: #fff;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: -16px; box-shadow: 0 3px 10px rgba(150, 90, 40, .4);
}

/* Формы */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { font-size: 13px; color: var(--hint); margin-bottom: -8px; }
.form input, .form textarea, .form select {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); font-size: 15px;
  width: 100%; font-family: inherit;
}
.form textarea { min-height: 90px; resize: vertical; }
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--accent);
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px; border: none; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-text);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:active { background: var(--accent-deep); }
.btn:disabled { opacity: .55; }
.btn-secondary {
  background: var(--card); color: var(--text);
  border: 1px solid var(--line);
}
.btn-secondary .ic { color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

.segmented {
  display: flex; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px;
}
.segmented button {
  flex: 1; padding: 9px; border: none; border-radius: 10px; background: none;
  color: var(--text); font-size: 14px; cursor: pointer;
}
.segmented button.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }

/* Карта */
#map-container {
  height: calc(100vh - 215px); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card);
}
.map-hint { margin-bottom: 8px; font-size: 13px; color: var(--hint); }
.map-balloon a { color: var(--accent-deep); font-weight: 600; text-decoration: none; }

/* Фильтр-панель */
.fs-section { margin-bottom: 16px; }
.fs-title {
  font-weight: 700; font-size: 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 7px;
}
.fs-title .ic { color: var(--accent); }
.fs-cat { margin-bottom: 10px; }
.fs-cat-name {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13.5px; margin-bottom: 6px;
  cursor: pointer; padding: 4px 10px; border-radius: 8px;
  border: 1px solid transparent;
}
.fs-cat-name.active { background: var(--accent); color: var(--accent-text); }
.fs-cat-name.active .ic { color: var(--accent-text); }
.fs-cat-name .ic { color: var(--accent); }
.fs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fs-actions {
  position: sticky; bottom: 0; display: flex; gap: 8px;
  padding: 10px 0 4px; background: var(--bg);
}
.fs-actions .btn { flex: 1; }

/* Поиск вуза */
.uni-search { position: relative; margin-bottom: 8px; }
.uni-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.uni-group {
  font-size: 11px; font-weight: 700; color: var(--hint); text-transform: uppercase;
  letter-spacing: .5px; padding: 8px 12px 4px; background: var(--bg);
  position: sticky; top: 0;
}
.uni-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; cursor: pointer; font-size: 14px;
  border-bottom: 1px solid var(--line); background: var(--card);
}
.uni-item:last-child { border-bottom: none; }
.uni-item.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.uni-item .ic { color: var(--accent); }

/* Профиль */
.profile-head {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--honey));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; flex-shrink: 0; object-fit: cover;
}
.profile-name { font-weight: 700; font-size: 17px; }
.profile-sub { font-size: 13px; color: var(--hint); margin-top: 2px; }
.stat-row { display: flex; gap: 10px; margin-bottom: 12px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
  text-align: center; box-shadow: var(--shadow);
}
.stat .num {
  font-weight: 700; font-size: 18px; color: var(--accent-deep);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.stat .num .ic { color: var(--honey); fill: var(--honey); }
.stat .lbl { font-size: 11px; color: var(--hint); margin-top: 2px; }

.section-title {
  font-weight: 700; font-size: 15px; margin: 18px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .ic { color: var(--accent); }

/* Модалка */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal.hidden, .hidden { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(45, 28, 12, .5); }
.modal-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg); border-radius: 18px 18px 0 0;
  max-height: 88vh; overflow-y: auto; padding: 8px 16px 24px;
  animation: slideUp .22s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle {
  width: 40px; height: 4px; border-radius: 2px; background: var(--hint);
  opacity: .4; margin: 6px auto 12px;
}

/* Детали объявления */
.detail-photos { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.detail-photos img { height: 180px; border-radius: 12px; }
.detail-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.detail-price { font-size: 17px; font-weight: 700; color: var(--accent-deep); margin-bottom: 10px; }
.detail-desc { line-height: 1.5; margin-bottom: 12px; white-space: pre-wrap; }
.detail-meta {
  font-size: 13px; color: var(--hint); margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 5px;
}
.detail-meta .ic { color: var(--accent); }
.detail-owner {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.detail-actions { display: flex; flex-direction: column; gap: 8px; }

/* Отзывы, звёзды */
.stars { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.stars button { background: none; border: none; cursor: pointer; color: var(--honey); opacity: .3; padding: 2px; }
.stars button.on { opacity: 1; }
.stars button.on .ic { fill: currentColor; }
.stars-inline { color: var(--honey); display: inline-flex; gap: 2px; }
.stars-inline .ic { fill: currentColor; }
.review-item { border-bottom: 1px solid var(--line); padding: 10px 0; }
.review-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 4px; }

/* Уведомления */
.notif-item {
  display: flex; gap: 10px; padding: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 8px; font-size: 14px;
}
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-time { font-size: 11px; color: var(--hint); margin-top: 4px; }

/* Фото-загрузка */
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-grid img { width: 70px; height: 70px; border-radius: 10px; object-fit: cover; }
.photo-add {
  width: 70px; height: 70px; border-radius: 10px; border: 2px dashed var(--hint);
  background: none; color: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* Тост */
.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: #3b2b1c; color: #fff5e9; padding: 10px 18px;
  border-radius: 20px; font-size: 14px; z-index: 200; max-width: 88vw; text-align: center;
  box-shadow: 0 4px 14px rgba(60, 35, 10, .35);
}

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-soft); border-radius: 6px;
  padding: 2px 8px; font-size: 12px; color: var(--accent-deep);
}

/* Ссылки на юр. документы внизу профиля */
.legal-links {
  margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line);
  text-align: center; font-size: 12px; color: var(--hint);
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.legal-links a { color: var(--hint); text-decoration: underline; }
.legal-links a:active { color: var(--accent); }

/* Просмотр текста документа */
.legal-text {
  white-space: pre-wrap; word-wrap: break-word;
  font-size: 13px; line-height: 1.55; color: var(--text);
  font-family: inherit;
}
