html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* =========================
   BASE.CSS
   Общие стили сайта
   ========================= */

.container {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

/* =========================
   ШАПКА
   ========================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  border-bottom: 1px solid #ffe2e2;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}

.header-logo {
  flex: 0 0 auto;
  min-width: 120px;
}

.logo-link {
  font-weight: 800;
  color: #000;
  text-decoration: none;
  font-size: 18px;
}

.logo-p {
  color: #c62828;
  font-weight: 900;
}

.header-search {
  flex: 1 1 auto;
  min-width: 220px;
}

.search-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  outline: none;
  font-size: 16px;
  box-sizing: border-box;
}

.search-input:focus {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.search-btn {
  border: 0;
  background: #c62828;
  color: #fff;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.header-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.header-nav .main-btn {
  padding: 8px 12px;
}

.nav-link {
  color: #c62828;
  text-decoration: none;
  font-weight: 700;
}

.nav-link:hover {
  text-decoration: underline;
}

.nav-user {
  color: #000;
  text-decoration: none;
  font-weight: 800;
}

.nav-user:hover {
  text-decoration: underline;
}

.nav-logout {
  display: inline;
}

.link-btn {
  border: 0;
  background: transparent;
  color: #c62828;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

/* =========================
   КНОПКИ
   ========================= */
.main-btn {
  display: inline-block;
  background: #c62828;
  color: #fff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 800;
  border: 0;
  cursor: pointer;
}

.main-btn:hover {
  filter: brightness(0.95);
}

.danger-btn {
  background: #c62828;
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.danger-btn:hover {
  filter: brightness(0.95);
}

/* =========================
   ОСНОВНОЙ КОНТЕНТ
   ========================= */
.page {
  flex: 1 0 auto;
  padding: 74px 0 24px;
}

/* =========================
   ВНУТРЕННИЙ МАКЕТ
   ========================= */
.page-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.page-sidebar {
  position: sticky;
  top: 90px;
}

.page-main {
  min-width: 0;
}

/* =========================
   SIDEBAR
   ========================= */
.sidebar-card {
  background: #fff;
  border: 1px solid #ffe2e2;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.sidebar-title {
  font-size: 18px;
  font-weight: 800;
  color: #111;
  margin-bottom: 12px;
}

.sidebar-text {
  color: #444;
  font-size: 14px;
  line-height: 1.45;
}

.sidebar-links {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  color: #c62828;
  text-decoration: none;
  font-weight: 700;
}

.sidebar-link:hover {
  text-decoration: underline;
}

/* =========================
   КАРТОЧКИ
   ========================= */
.page-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #ffeded;
  padding: 26px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.page-title {
  margin: 0 0 6px;
  font-size: 34px;
  font-weight: 800;
  text-align: center;
}

.page-subtitle {
  text-align: center;
  margin-bottom: 18px;
}

.back-link {
  color: #c62828;
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

/* =========================
   ФОРМЫ
   ========================= */
.ad-form {
  margin-top: 10px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-label {
  font-weight: 700;
  color: #111;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  outline: none;
  font-size: 16px;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.form-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.form-errors,
.field-error {
  background: #fff5f5;
  border: 1px solid #ffd6d6;
  color: #a31616;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

/* =========================
   ГЛАВНАЯ
   - белая шапка
   - без левого блока
   - без поиска в шапке
   ========================= */
.home .site-header {
  position: static;
  background: #fff;
  border-bottom: 1px solid #ffe2e2;
}

.home .page {
  padding: 0;
}

.home .page-shell {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
}

.home .page-sidebar {
  display: none;
}

.home .page-main {
  width: 100%;
}

.home .header-row {
  padding: 12px 0;
}

/* =========================
   HERO
   ========================= */
.home-hero {
  min-height: 420px;
  background: #111;
  background-image: url("/static/hero.jpg");
  background-size: cover;
  background-position: center;
}

.home-hero-overlay {
  min-height: 420px;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.home-hero-box {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 26px 22px;
  border: 1px solid #ffe1e1;
  box-sizing: border-box;
}

.home-hero-title {
  width: min(920px, 100%);
  margin: 0 auto 8px;
  font-size: 40px;
  color: #000;
}

.home-hero-subtitle {
  width: min(920px, 100%);
  margin: 0 auto 18px;
  color: #333;
  font-size: 18px;
}

.home-hero-search {
  display: flex;
  gap: 10px;
  width: min(920px, 100%);
  margin: 0 auto;
  align-items: center;
}

.home-hero-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d6d6d6;
  outline: none;
  box-sizing: border-box;
}

.home-hero-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  background: #c62828;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.home-hero-actions {
  width: min(920px, 100%);
  margin: 14px auto 0;
}

.home-hero-link {
  color: #c62828;
  text-decoration: none;
  font-weight: 800;
}

.home-hero-link:hover {
  text-decoration: underline;
}

/* =========================
   КАТАЛОГ РУБРИК
   ========================= */
.home-cats {
  padding: 28px 16px 46px;
  background: #ffecec;
}

.home-cats-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.home-cats-title {
  margin: 0 0 18px 0;
  font-size: 28px;
  color: #000;
  text-align: center;
}

.home-cats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.cat-card {
  background: #fff;
  border: 1px solid #ffe1e1;
  border-radius: 14px;
  padding: 16px;
}

.cat-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 900;
  color: #c62828;
  margin-bottom: 10px;
}

.cat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c62828;
  flex: 0 0 10px;
}

.cat-list {
  margin: 0;
  padding-left: 18px;
}

.cat-list a {
  color: #000;
  text-decoration: none;
}

.cat-list a:hover {
  color: #c62828;
  text-decoration: underline;
}

/* =========================
   ФУТЕР
   ========================= */
.site-footer {
  margin-top: auto;
  background: #111;
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 28px 0;
}

.footer-col {
  min-width: 0;
}

.footer-col-right {
  text-align: right;
}

.footer-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
  color: #fff;
}

.footer-text {
  color: #cfcfcf;
  font-size: 14px;
  line-height: 1.5;
}

.footer-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.footer-link:hover {
  text-decoration: underline;
}

/* =========================
   АДАПТИВ
   ========================= */
@media (max-width: 1024px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .page-sidebar {
    position: static;
    order: 2;
  }

  .page-main {
    order: 1;
  }

  .home-cats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-col-right {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }

  .header-row {
    gap: 10px;
    flex-wrap: wrap;
  }

  .header-logo {
    min-width: auto;
  }

  .header-search {
    order: 3;
    width: 100%;
    min-width: 100%;
  }

  .search-form {
    width: 100%;
  }

  .header-nav {
    gap: 10px;
    flex-wrap: wrap;
  }

  .page {
    padding-top: 104px;
  }

  .home .page {
    padding-top: 0;
  }

  .home-hero-overlay {
    padding: 32px 12px;
  }

  .home-hero-title {
    width: 100%;
    margin: 0 0 8px;
    font-size: 30px;
  }

  .home-hero-subtitle,
  .home-hero-search,
  .home-hero-actions {
    width: 100%;
  }

  .home-hero-search {
    flex-wrap: wrap;
  }

  .home-cats-grid {
    grid-template-columns: 1fr;
  }

  .page-card {
    padding: 18px;
  }
}