/* public/css/main.css (SC / SeoCatalog-2.0)
   Стили под текущую разметку из sc-main.zip:
   site-header, drawer, filters, grid, card, badge, load-more, seo, site-footer, modal
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --primary: #0f766e;
  --primary-2: #14b8a6;
  --ink: #0f172a;
  --muted: #64748b;
  --muted-2: #6b7280;

  --bg: #f1f5f9;
  --panel: #ffffff;

  --border: #e2e8f0;
  --shadow: 0 10px 24px rgba(2, 6, 23, 0.06);

  --radius-xl: 16px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --maxw: 1240px;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
}

/* базовые элементы */
a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 3px solid rgba(20, 184, 166, 0.35);
  outline-offset: 2px;
}

/* контейнер страниц */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 32px;
}

/* ===== HEADER ===== */
.site-header {
  max-width: var(--maxw);
  margin: 18px auto 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
  z-index: 40;
}

.site-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: inline-block;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ===== BUTTONS ===== */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
  font-weight: 700;
}

.btn--ghost:hover {
  background: #f1f5f9;
}

/* ===== DRAWER (sections) ===== */
.drawer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 60;
}

.drawer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.drawer__backdrop {
  flex: 1 1 auto;
  background: rgba(15, 23, 42, 0.45);
}

.drawer__panel {
  width: min(360px, 88vw);
  background: #f8fafc;
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 30px rgba(15, 23, 42, 0.18);
  padding: 16px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateX(14px);
  transition: transform 180ms ease;
}

.drawer.is-open .drawer__panel {
  transform: translateX(0);
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer__head strong {
  font-size: 0.95rem;
}

.drawer__list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
}

.drawer__list li + li {
  margin-top: 4px;
}

.drawer__list a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
}

.drawer__list a:hover {
  background: #e0f2fe;
}

.drawer__list a[aria-current="page"] {
  background: var(--primary);
  color: #ecfdf5;
  font-weight: 800;
}

/* ===== LISTING LAYOUT (filters left, cards right) ===== */
/* Без изменения HTML: делаем сайдбар на широких экранах через float + sibling selectors */
@media (min-width: 980px) {
  .filters {
    float: left;
    width: 280px;
    margin: 0 20px 20px 0;
    position: sticky;
    top: 92px; /* ниже sticky header */
  }

  /* cards рядом с фильтрами */
  .filters + .grid {
    margin-left: 300px;
  }

  /* блоки ниже сетки — на всю ширину */
  .load-more,
  .seo {
    clear: both;
  }
}

/* ===== TITLES ===== */
h1 {
  margin: 10px 0 14px;
  font-size: 1.25rem;
  font-weight: 800;
}

/* ===== FILTERS ===== */
.filters {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-items: end;
  margin: 12px 0 18px;
}

.filters__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters__item > span {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.filters select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 10px 12px;
  font-size: 0.92rem;
  background: #ffffff;
  color: var(--ink);
}

.filters .btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
}

/* ===== GRID ===== */
.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 980px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ===== CARD ===== */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.02);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.card__preview {
  position: relative;
  background: #e5e7eb;
  aspect-ratio: 16 / 9;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #ffffff;
  font-weight: 900;
  font-size: 1.8rem;
}

.card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card__title {
  margin: 0;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
  background: #ffffff;
  color: var(--ink);
}

/* Price badges by data-price */
.badge[data-price="free"] {
  background: #ecfdf3;
  border-color: rgba(22, 163, 74, 0.2);
}
.badge[data-price="cheap"] {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.2);
}
.badge[data-price="ok"] {
  background: #fef9c3;
  border-color: rgba(234, 179, 8, 0.22);
}
.badge[data-price="expensive"] {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.22);
}

.card__desc {
  margin: 0;
  font-size: 0.92rem;
  color: #4b5563;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 3;
  -webkit-line-clamp: 3;
}

.card__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  font-size: 0.82rem;
  color: #334155;
}

.card__meta span {
  color: #334155;
}

.card__btn {
  margin-top: auto;
  align-self: flex-end;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid rgba(15, 118, 110, 0.25);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.12);
}

.card__btn:hover {
  background: #0d6b64;
}

.btn-icon {
  width: 20px;
  height: 20px;
}

/* ===== LOAD MORE ===== */
.load-more {
  margin: 18px 0 10px;
  display: flex;
  justify-content: center;
}

.load-more .btn {
  min-width: 240px;
  padding: 12px 16px;
}

/* ===== SEO BLOCK ===== */
.seo {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--ink);
}

.seo h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 900;
}

.seo p {
  margin: 0 0 10px;
  color: #374151;
  line-height: 1.6;
}

/* ===== FOOTER + MODAL ===== */
.site-footer {
  max-width: var(--maxw);
  margin: 28px auto 10px;
  padding: 0 24px 28px;
  display: flex;
  justify-content: flex-start;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.modal__dialog {
  position: relative;
  width: min(720px, calc(100% - 32px));
  max-height: min(680px, calc(100% - 40px));
  overflow: auto;
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.35);
  padding: 18px 18px 16px;
}

.modal__dialog h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 900;
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 10px;
  border-radius: 12px;
}

/* form inside modal */
.modal form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.modal label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 800;
}

.modal input,
.modal textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #f9fafb;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.modal textarea {
  resize: vertical;
  min-height: 92px;
}

.muted {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 0.85rem;
}

/* ===== CATALOG PAGE extras ===== */
.catalog-long {
  margin: 14px 0;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  background: #ffffff;
  color: #334155;
  line-height: 1.6;
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .container {
    padding: 0 12px 24px;
  }

  .site-header {
    margin: 12px 12px 14px;
    top: 8px;
    padding: 10px 12px;
  }

  .tagline {
    font-size: 0.9rem;
  }

  .drawer__panel {
    width: min(340px, 90vw);
  }

  .filters {
    margin: 10px 0 14px;
    padding: 12px;
  }

  .card__meta {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 0 12px 22px;
  }
}