/* ── Публичная часть — серая тема ───────────────────────────────── */

.pub-body {
  background: #f2f4f7;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #1e2532;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Админ-бар ──────────────────────────────────────────────────── */
.admin-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 36px;
  background: #101318;
  color: #8e9bb5;
  font-size: 12px;
  z-index: 300;
  border-bottom: 1px solid #1e2432;
}
.admin-bar-inner {
  max-width: none;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-bar-label { color: #6b7a99; font-weight: 500; }
.admin-bar-maint {
  background: #5a2a00;
  color: #ffb74d;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.admin-bar-right { display: flex; align-items: center; gap: 8px; }
.admin-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #1e2d4a;
  color: #7baee8;
  border: 1px solid #2a3f66;
  border-radius: 5px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.admin-bar-btn:hover { background: #253762; color: #a8cbf5; }

.has-admin-bar { padding-top: 36px; }
.has-admin-bar .pub-header { top: 36px; }
.has-admin-bar .pub-cat-bar { top: calc(36px + 60px); }

/* ── Шапка ─────────────────────────────────────────────────────── */
.pub-header {
  background: #303641;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.pub-header-inner {
  max-width: none;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  min-height: 60px;
  gap: 18px;
  flex-wrap: nowrap;
  overflow: visible;
}

.pub-logo img {
  display: block;
  background: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  height: 42px;
  width: auto;
}

/* ── Полоса категорий ────────────────────────────────────────── */
.pub-cat-bar {
  background: #272c36;
  border-bottom: 1px solid #1e2330;
  position: sticky;
  top: 60px;
  z-index: 190;
}

.pub-cat-bar-inner {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 12px;
}
.pub-cat-bar-inner::-webkit-scrollbar { display: none; }

.pub-cat-bar-link {
  color: #9aa3b5;
  text-decoration: none;
  padding: 9px 13px;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
  display: block;
}

.pub-cat-bar-link:hover  { color: #e0e4ed; }
.pub-cat-bar-link.active { color: #fff; font-weight: 600; border-bottom-color: #536eaa; }

.pub-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pub-user-name { font-size: 13px; color: #8892a4; }

.pub-btn-login {
  text-decoration: none;
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  background: #536eaa;
  color: #fff;
  transition: background .12s;
}
.pub-btn-login:hover { background: #3d5491; }

.pub-btn-register {
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: #a8b0be;
  border: 1px solid #4a5265;
  transition: background .12s, color .12s;
}
.pub-btn-register:hover { background: #3e4552; color: #e8ecf2; }

.pub-btn-logout {
  text-decoration: none;
  font-size: 12px;
  color: #6b7585;
}
.pub-btn-logout:hover { color: #a8b0be; }

/* ── Хлебные крошки ──────────────────────────────────────────── */
.pub-breadcrumbs {
  background: #e8eaee;
  border-bottom: 1px solid #d4d8de;
}

.pub-breadcrumbs-inner {
  max-width: none;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #666;
}

.pub-breadcrumbs a { color: #536eaa; text-decoration: none; }
.pub-breadcrumbs a:hover { text-decoration: underline; }
.pub-breadcrumbs .sep { color: #bbb; }

/* ── Основной контент ─────────────────────────────────────────── */
.pub-main { min-height: calc(100vh - 52px - 58px); flex: 1; }

/* ── Главная — герой ──────────────────────────────────────────── */
.pub-hero {
  background:
    linear-gradient(rgba(20, 26, 38, 0.55), rgba(20, 26, 38, 0.65)),
    url('/img/steel3.jpg') center 40% / cover no-repeat;
  border-bottom: 1px solid #111620;
  padding: 52px 20px 48px;
  text-align: center;
}

.pub-hero h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #ffffff;
  line-height: 1.3;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}

.pub-hero p {
  font-size: 15px;
  color: #b8c4d8;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.65;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ── Главная — сетка категорий ───────────────────────────────── */
.pub-home-section {
  max-width: 1300px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.home-corner-deco {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 460px;
  height: 310px;
  background: url('/img/steel2.png') right bottom / contain no-repeat;
  opacity: .13;
  pointer-events: none;
  z-index: 0;
}

.pub-home-section h2 {
  font-size: 16px;
  font-weight: 700;
  color: #1e2532;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #d0d4dc;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pub-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
}

.pub-cat-card {
  display: block;
  background: #fff;
  border: 1px solid #d0d4dc;
  border-radius: 0;
  padding: 18px 12px 14px;
  text-decoration: none;
  color: #1e2532;
  transition: border-color .15s, background .15s;
  text-align: center;
}

.pub-cat-card:hover {
  border-color: #536eaa;
  background: #f4f7ff;
}

.pub-cat-card.no-offers {
  opacity: .55;
}

.pub-cat-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e2532;
  margin-bottom: 6px;
}

.pub-cat-card-count {
  font-size: 11px;
  color: #7a8394;
}

/* ── Страница категории ───────────────────────────────────────── */
.pub-catalog-wrap {
  padding: 16px 20px 40px;
}

.pub-catalog-head {
  margin-bottom: 14px;
}

.pub-catalog-head h1 {
  font-size: 20px;
  font-weight: 700;
  color: #1e2532;
  margin-bottom: 3px;
}

.pub-catalog-head p {
  color: #6b7585;
  font-size: 13px;
}

/* ── Фильтры ──────────────────────────────────────────────────── */
.pub-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 0;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
  border: 1px solid #d0d4dc;
  border-bottom: none;
  padding: 7px 12px;
  position: sticky;
  top: 100px;
  z-index: 80;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.pub-filter-bar::-webkit-scrollbar { display: none; }

.filter-label {
  font-size: 11px;
  font-weight: 700;
  color: #9aa3b2;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 2px;
}

.city-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.city-coat-preview {
  height: 20px;
  width: auto;
  flex-shrink: 0;
  border-radius: 2px;
}

.filter-sep {
  width: 1px;
  height: 18px;
  background: #d0d4dc;
  flex-shrink: 0;
  margin: 0 2px;
}

.pub-filter-bar input,
.pub-filter-bar select,
.pub-filter-bar .f-attr {
  height: 28px;
  padding: 0 8px;
  border: 1px solid #c4c8d0;
  border-radius: 3px;
  font-size: 12px;
  background: #f7f8fa;
  color: #1e2532;
  flex-shrink: 0;
  box-sizing: border-box;
}

.pub-filter-bar input[type="text"] { width: 180px; min-width: 0; background: #fff; }
.pub-filter-bar select             { width: auto; min-width: 115px; }
.pub-filter-bar .f-attr            { width: auto; min-width: 115px; }

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #e0a0a0;
  border-radius: 3px;
  background: #fff4f4;
  color: #b03030;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .12s, border-color .12s;
}
.btn-reset-filters:hover { background: #ffe0e0; border-color: #cc6666; }

.pub-filter-bar input:focus,
.pub-filter-bar select:focus,
.pub-filter-bar .f-attr:focus {
  outline: none;
  border-color: #536eaa;
  box-shadow: 0 0 0 2px rgba(83,110,170,.13);
  background: #fff;
}

.pub-results-count {
  font-size: 13px;
  color: #6b7585;
  margin-bottom: 8px;
}

/* ── Таблица — широкая ────────────────────────────────────────── */
.pub-table-scroll {
  border-radius: 0;
  border: 1px solid #d0d4dc;
  background: #fff;
  overflow: visible;
}

.pub-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  margin-bottom: 0;
}

.pub-table thead {
  background: transparent;
}

.pub-table thead th {
  background: #e8eaee;
  color: #2d3441;
  font-weight: 700;
  text-align: left;
  padding: 8px 11px;
  border-bottom: 2px solid #c8ccd4;
  white-space: nowrap;
}

.pub-sticky-thead {
  position: fixed;
  z-index: 75;
  display: none;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.pub-table tbody td {
  padding: 6px 11px;
  border-bottom: 1px solid #ebebeb;
  vertical-align: middle;
}

.pub-table tbody tr:hover td { background: #f7f8fa; }
.pub-table tr.group-sep td { border-top: 2px solid #c8ccd4; }

.pub-table .col-price {
  font-weight: 700;
  color: #1f6f3a;
  white-space: nowrap;
}

.pub-table .col-product  { max-width: 300px; }
.pub-table .col-stock    { color: #2980b9; font-size: 12px; white-space: nowrap; }
.pub-table .col-city     { font-size: 12px; color: #555; white-space: nowrap; }
.pub-table .col-raw      { width: 20px; text-align: center; }
.pub-table .col-supplier { font-weight: 600; white-space: nowrap; }
.pub-table .col-contact  { font-size: 12px; }
.pub-table .attrs-line   { color: #7a8394; font-size: 11px; line-height: 1.4; }

/* ── Заблокированные колонки (нет авторизации) ────────────── */
.pub-table .th-locked {
  background: #eef1f7;
  color: #8895b0;
}

.th-lock-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 7px;
  background: #536eaa;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.th-lock-link::before { content: '🔒'; font-size: 9px; }
.th-lock-link:hover   { background: #3d5491; color: #fff; }

.info-blur {
  display: inline-block;
  filter: blur(4px);
  user-select: none;
  pointer-events: none;
  color: #444;
  white-space: nowrap;
}

.contact-locked {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #536eaa;
  text-decoration: none;
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid #b8c6e0;
  border-radius: 3px;
  background: #eef2fa;
  white-space: nowrap;
}
.contact-locked:hover { background: #dde6f7; }
.contact-locked::before { content: '🔒'; font-size: 10px; }

.col-raw-name {
  font-size: 11px;
  color: #3d6fa8;
  font-style: italic;
  max-width: 200px;
  word-break: break-word;
}
.col-raw-name-th { color: #3d6fa8; }
.col-raw-empty   { color: #c5ccd8; font-style: normal; }

/* ── Пагинация ─────────────────────────────────────────────── */
.pub-pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
  flex-wrap: wrap;
}

.pub-pagination button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid #d0d4dc;
  color: #444;
  background: #fff;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.pub-pagination button:hover:not(:disabled) { background: #eef2fa; border-color: #536eaa; }
.pub-pagination button.current { background: #536eaa; color: #fff; border-color: #536eaa; font-weight: 700; }
.pub-pagination button:disabled { color: #bbb; cursor: not-allowed; }

/* ── Формы авторизации ────────────────────────────────────── */
.pub-auth-wrap {
  min-height: calc(100vh - 52px - 58px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: #f2f4f7;
}

.pub-auth-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #d0d4dc;
  padding: 36px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
}

.pub-auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: #1e2532;
  margin-bottom: 5px;
}

.pub-auth-card .sub {
  color: #6b7585;
  font-size: 13px;
  margin-bottom: 22px;
}

.pub-auth-card .form-group { margin-bottom: 13px; }

.pub-auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3a4050;
  margin-bottom: 4px;
}

.pub-auth-card input[type=text],
.pub-auth-card input[type=email],
.pub-auth-card input[type=password] {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #c4c8d0;
  border-radius: 5px;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color .12s, box-shadow .12s;
}

.pub-auth-card input:focus {
  outline: none;
  border-color: #536eaa;
  box-shadow: 0 0 0 3px rgba(83,110,170,.14);
}

.pub-auth-btn {
  width: 100%;
  padding: 9px;
  background: #536eaa;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background .12s;
}
.pub-auth-btn:hover { background: #3d5491; }

.pub-auth-link {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #6b7585;
}
.pub-auth-link a { color: #536eaa; }

.pw-strength-bar {
  height: 4px;
  background: #e0e3ea;
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.pw-strength-bar > div {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width .25s, background .25s;
}
.pw-weak   { background: #e05252; }
.pw-medium { background: #e09a30; }
.pw-good   { background: #5aab6e; }
.pw-strong { background: #1f6f3a; }

.pw-hint {
  font-size: 11px;
  color: #7a8394;
  margin-top: 4px;
  min-height: 14px;
}

.pub-auth-error {
  background: #fde8e8;
  border: 1px solid #f5c6c6;
  color: #b03030;
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 13px;
  margin-bottom: 13px;
}

/* ── Подвал ──────────────────────────────────────────────── */
.pub-footer {
  background: #303641;
  color: #6b7585;
  padding: 18px 20px;
}

.pub-footer-inner {
  max-width: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.pub-footer a { color: #7b93c8; text-decoration: none; }
.pub-footer a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   МОБИЛЬНАЯ АДАПТАЦИЯ  ≤ 640px
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Шапка ── */
  .pub-header-inner { min-height: 52px; padding: 0 12px; gap: 10px; }
  .pub-logo img     { height: 34px; padding: 3px 5px; }
  .pub-btn-register { display: none; }          /* прячем «Регистрация» — ссылка есть на форме входа */
  .pub-btn-login    { padding: 5px 12px; font-size: 12px; }
  .pub-user-name    { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ── Полоса категорий ── */
  .pub-cat-bar { top: 52px; }
  .pub-cat-bar-link { padding: 8px 10px; font-size: 12px; }

  /* ── Герой ── */
  .pub-hero          { padding: 22px 14px 18px; }
  .pub-hero h1       { font-size: 20px; }
  .pub-hero p        { font-size: 13px; }

  /* ── Сетка категорий ── */
  .pub-home-section  { padding: 16px 12px 28px; }
  .pub-cat-grid      { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .pub-cat-card      { padding: 14px 8px 10px; }
  .pub-cat-card-name { font-size: 13px; }

  /* ── Каталог ── */
  .pub-catalog-wrap      { padding: 10px 10px 28px; }
  .pub-catalog-head h1   { font-size: 16px; }
  .pub-catalog-head p    { font-size: 12px; }
  .pub-filter-bar        { padding: 6px 8px; gap: 5px; }

  /* ── Формы авторизации: убираем вертикальное центрирование,
         прижимаем к верху с небольшим отступом ── */
  .pub-auth-wrap {
    align-items: flex-start;
    padding: 20px 10px 32px;
    min-height: 0;
  }
  .pub-auth-card {
    padding: 24px 16px 20px;
    border-radius: 0;
    box-shadow: none;
    border-left: none;
    border-right: none;
    width: 100%;
    max-width: none;
  }
  .pub-auth-card h1 { font-size: 18px; }

  /* ── Подвал ── */
  .pub-footer-inner { flex-direction: column; text-align: center; gap: 4px; }
  .pub-main { min-height: 0; }

  /* ── Таблица → карточки (нет горизонтального скролла) ── */
  .pub-sticky-thead { display: none !important; }
  .pub-table thead  { display: none; }
  .pub-table,
  .pub-table tbody  { display: block; }

  .pub-table tr {
    display: block;
    border: 1px solid #d0d4dc;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #fff;
  }
  .pub-table tr.group-sep td { border-top: none; }

  .pub-table td {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 2px 0;
    border-bottom: none;
    font-size: 13px;
  }
  .pub-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    color: #9aa3b2;
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 70px;
    flex-shrink: 0;
  }

  /* Название товара — заголовок карточки, без метки */
  .pub-table .col-product {
    display: block;
    padding-bottom: 7px;
    margin-bottom: 4px;
    border-bottom: 1px solid #ebebeb;
    font-size: 13px;
  }
  .pub-table .col-product::before { display: none; }
  .pub-table .col-product .attrs-line { display: block; margin-top: 2px; }

  /* Email на мобильном не нужен */
  .pub-table .col-email { display: none; }

  /* «В прайсе» — полный текст без обрезки */
  .pub-table .col-raw-name {
    font-size: 12px;
    max-width: none;
    word-break: break-word;
  }

  /* Ширина колонки «город» без ограничений */
  .pub-table .col-city { max-width: none; }
  .pub-table .col-product { max-width: none; }

  /* Фильтр-бар: правильный top под мобильную шапку (52px header + ~38px cat-bar) */
  .pub-filter-bar { top: 90px; }

  /* has-admin-bar: admin bar 36px + mobile header 52px = 88px для cat-bar */
  .has-admin-bar .pub-cat-bar    { top: calc(36px + 52px); }
  .has-admin-bar .pub-filter-bar { top: calc(36px + 52px + 36px); }
}
