/* Мини-приложение СОЮЗа (06.09). Основа — ui/opalubka_mirror/styles.css:
   те же шапка, фильтры, лента и карточки, чтобы приложение выглядело как
   зеркало своей ветки. Убраны GIF «Нам 10 лет», кнопка «Назад» и строка .sub
   со ссылками — в шапке приложения ссылок нет. Тёмная тема — базовая (как у
   зеркал), светлая приходит из /data/mirror_theme_overrides.css. */
* {
  box-sizing: border-box;
}
/* Атрибут hidden сильнее любого display у класса: иначе .filter-pair{display:flex}
   и .forum-btn показывали скрытые селект «Отрасль» и кнопку «← К темам» (ревью 06.09). */
[hidden] {
  display: none !important;
}
:root {
  --card: #1e293b;
  --accent: #2563eb;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body.mirror-feed--amber {
  --accent: #ca8a04;
}
[data-theme="light"] body.mirror-feed {
  --card: #ffffff;
}

/* ——— Шапка ——— */
.top {
  padding: 0.9rem 1rem 0.75rem;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}
.top-bar {
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 14px;
  row-gap: 8px;
}
.top-bar-mirror-unions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
/* Кнопка-логотип: как .mirror-union-logo зеркал (46px), но это <button>,
   а не ссылка — ведёт в канал Telegram через SDK. Сброс оформления кнопки
   с запасом по специфичности: светлая тема красит все button белым. */
body.mirror-feed .top-bar-mirror-unions .mirror-union-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px;
  overflow: hidden;
  background: transparent !important;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
body.mirror-feed .top-bar-mirror-unions .mirror-union-logo:hover,
body.mirror-feed .top-bar-mirror-unions .mirror-union-logo:active {
  transform: scale(1.06);
  opacity: 0.95;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.42);
}
/* Свой союз — первым и с рамкой в цвет ветки, чтобы был виден сразу. */
body.mirror-feed .top-bar-mirror-unions .mirror-union-logo--own {
  box-shadow: 0 0 0 2px var(--accent), 0 2px 12px rgba(0, 0, 0, 0.35);
}
.mirror-union-logo__wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 30% 25%,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.08) 58%,
    rgba(0, 0, 0, 0.16) 100%
  );
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.mirror-union-logo__wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
/* У ленты без своего логотипа (грузоперевозки) — значок вместо картинки. */
.mirror-union-logo__emoji {
  font-size: 24px;
  line-height: 1;
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 0.25rem;
}
.title-row .mirror-theme-slot { margin: 0; flex-shrink: 0; }
/* Экран доступа: одна кнопка на всю ширину, ничего лишнего. */
.gate {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.gate .app-btn { width: 100%; min-height: 48px; font-size: 15px; }
.gate .gate-note { margin: 8px 0 0; font-size: 12px; opacity: 0.8; text-align: center; }
.gate .gate-note a { color: inherit; text-decoration: underline; }
.top h1 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
  word-break: break-word;
}

/* ——— Вкладки (стиль .mirror-site-type-btn из overrides, но это кнопки) ——— */
.mirror-site-type-btns .mirror-site-type-btn {
  min-height: 36px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
}
.ti-red { color: #d21f1f; }
.ti-blue { color: #1d4ed8; }
/* Активная «СоюзИнформ»: синяя заливка спрятала бы синюю половину слова,
   поэтому активная кнопка этой вкладки белая с синей рамкой в обеих темах. */
body.mirror-feed .mirror-site-type-btns .tab-inform.mirror-site-type-btn--active {
  background: #ffffff !important;
  border-color: #1d4ed8 !important;
  color: #0f172a !important;
}

/* ——— Фильтры ленты (как у зеркал) ——— */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-start;
  padding: 1rem;
  background: #111827;
}
.filters label {
  font-size: 0.75rem;
  color: #94a3b8;
}
.filter-pair {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 auto;
  min-width: min(100%, 180px);
}
.filter-pair--action {
  flex: 0 0 auto;
  align-self: flex-end;
}
.geo-stack {
  flex: 1 1 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.geo-level-hidden {
  display: none !important;
}
select,
button,
input,
textarea {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
  min-height: 38px;
  max-width: 100%;
}
input,
textarea {
  width: 100%;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
/* Главная кнопка ветки: «Показать» и кнопки приложения. */
#apply,
.app-btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}
#apply:hover,
.app-btn--primary:hover {
  background: #1d4ed8;
}
body.mirror-feed--amber #apply,
body.mirror-feed--amber .app-btn--primary {
  background: #ca8a04;
  border-color: #ca8a04;
  color: #0f172a;
}
body.mirror-feed--amber #apply:hover,
body.mirror-feed--amber .app-btn--primary:hover {
  background: #a16207;
  border-color: #a16207;
}
[data-theme="light"] body.mirror-feed .app-btn--primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
}
[data-theme="light"] body.mirror-feed.mirror-feed--amber .app-btn--primary {
  background: #ca8a04 !important;
  border-color: #a16207 !important;
  color: #0f172a !important;
}
[data-theme="light"] body.mirror-feed input,
[data-theme="light"] body.mirror-feed textarea {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
.app-btn--ghost {
  background: transparent;
}
.app-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.app-row > * {
  flex: 1 1 auto;
  min-width: 0;
}
.app-row > button {
  flex: 0 0 auto;
}

/* ——— Лента и карточки (как у зеркал) ——— */
.feed {
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
}
.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.meta {
  font-size: 0.8rem;
  color: #38bdf8;
  margin-bottom: 0.35rem;
}
body.mirror-feed--amber .meta {
  color: #fbbf24;
}
.txt {
  white-space: pre-wrap;
  word-break: break-word;
}
.card-actions {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.btn-source, .btn-orig {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  text-decoration: none;
  font-weight: 500;
}
.btn-source {
  background: #0ea5e9;
  color: #fff;
}
.btn-orig {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #475569;
}
.btn-source:hover { background: #0284c7; }
.btn-orig:hover { color: #cbd5e1; border-color: #64748b; }
.card-ad-mark {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-bottom: 0.35rem;
}
/* Фотография объявления (01.09). Показ включается на сервере; когда фото нет,
   правило просто не применяется. */
.card-photo {
  margin: 0 0 10px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
}
.card-photo img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}
.app-note {
  opacity: 0.75;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}
.app-error {
  color: #fca5a5;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}
[data-theme="light"] body.mirror-feed .app-error {
  color: #b91c1c;
}

/* ——— СоюзИнформ: чипы жанров ——— */
.inform-bar {
  padding: 0.75rem 1rem;
  background: #111827;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
[data-theme="light"] body.mirror-feed .inform-bar {
  background: #e2e8f0;
}
.inform-bar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
}
.inform-bar__row .filter-pair {
  flex: 1 1 200px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  min-height: 36px;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
body.mirror-feed .chips .chip--active {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
body.mirror-feed--amber .chips .chip--active {
  color: #0f172a !important;
}

/* ——— Рейтинг ——— */
.rating-top {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 8px;
}
.rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid rgba(128, 128, 128, 0.18);
  cursor: pointer;
}
.rating-row__n {
  opacity: 0.6;
  min-width: 1.6em;
}
.rating-row__subject {
  font-weight: 650;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rating-row__avg {
  white-space: nowrap;
}
.rating-stars {
  color: #f59e0b;
  letter-spacing: 1px;
}
.rating-card__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.rating-card__avg {
  font-size: 1.6rem;
  font-weight: 700;
}
.rating-review {
  padding: 10px 0;
  border-top: 1px solid rgba(128, 128, 128, 0.18);
}
.rating-review__author {
  font-size: 0.85rem;
  opacity: 0.7;
}
.rating-pick {
  display: flex;
  gap: 6px;
  margin: 0.5rem 0;
}
.rating-pick button {
  flex: 1 1 0;
  font-size: 1.3rem;
  min-height: 42px;
  padding: 0;
}
body.mirror-feed .rating-pick .rating-star--on {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: #0f172a !important;
}
.rating-form textarea {
  resize: vertical;
  min-height: 72px;
}
.rating-form .app-row {
  margin-top: 0.5rem;
}

/* ——— Мобильная вёрстка: всё в одну колонку, ничего за экран ——— */
@media (max-width: 600px) {
  .top {
    padding: 0.75rem 0.75rem 0.6rem;
  }
  .filters,
  .inform-bar,
  .feed {
    padding: 0.75rem;
  }
  .filter-pair {
    min-width: 100%;
  }
  .filter-pair--action {
    width: 100%;
  }
  .filter-pair--action button {
    width: 100%;
  }
  .mirror-site-type-btns {
    gap: 6px;
  }
  .mirror-site-type-btns .mirror-site-type-btn {
    padding: 6px 9px;
  }
}

/* Жёлтая гамма спецтехники — те же правила, что у янтарной, другие цвета. */
body.mirror-feed--yellow {
  --accent: #eab308;
}
body.mirror-feed--yellow #apply,
body.mirror-feed--yellow .app-btn--primary {
  background: #eab308;
  border-color: #eab308;
  color: #0f172a;
}
body.mirror-feed--yellow #apply:hover,
body.mirror-feed--yellow .app-btn--primary:hover {
  background: #ca8a04;
  border-color: #ca8a04;
}
[data-theme="light"] body.mirror-feed.mirror-feed--yellow .app-btn--primary {
  background: #eab308 !important;
  border-color: #ca8a04 !important;
  color: #0f172a !important;
}
body.mirror-feed--yellow .meta {
  color: #fbbf24;
}
body.mirror-feed--yellow .chips .chip--active {
  color: #0f172a !important;
}
