/* =====================================================================
   FREX Games Engine — основные стили
   Цвета, шрифт и радиус приходят из админки через CSS-переменные,
   которые подставляются в <head> (см. templates/header.php)
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* ------------------------- Иконки (includes/icons.php) ------------------------- */
.ico { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex-shrink: 0; }
.ico-lg { width: 1.5em; height: 1.5em; }
.ico-xl { width: 2.2em; height: 2.2em; }
.ico-sm { width: 1em; height: 1em; }

/* Кнопка переключения темы: показываем иконку той темы, на которую переключит клик */
.ico-theme-moon { display: none; }
html[data-theme="light"] .ico-theme-sun { display: none; }
html[data-theme="light"] .ico-theme-moon { display: inline-block; }

:root {
  --maxw: 1280px;
  --gap: 20px;
  --tr: .18s ease;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.25; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.75rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

.main { flex: 1 0 auto; padding: 28px 0 48px; }

/* ------------------------- Кнопки ------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 0;
  border-radius: calc(var(--radius) * 1px);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--tr), filter var(--tr), background var(--tr);
  text-align: center;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-accent { background: var(--accent); color: #06231d; }
.btn-accent:hover { color: #06231d; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #e74c5e; }
.btn-sm { padding: 7px 13px; font-size: .875rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ------------------------- Карточки ------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  padding: 20px;
}

/* ------------------------- Формы ------------------------- */
label { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 600; color: var(--muted); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  color: var(--text);
  font: inherit;
  transition: border-color var(--tr), box-shadow var(--tr);
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
textarea { min-height: 120px; resize: vertical; font-family: inherit; }
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 220px; margin-bottom: 16px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 5px; font-weight: 400; }

.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--text); cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--primary); }

/* ------------------------- Шапка ------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-top { display: flex; align-items: center; gap: 18px; padding: 13px 0; }

.logo { display: flex; align-items: center; gap: 10px; font-size: 1.22rem; font-weight: 800; color: var(--text); flex-shrink: 0; }
.logo:hover { color: var(--text); }
.logo-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  font-size: 1.05rem; color: #fff; font-weight: 800;
}
.logo img { height: 38px; width: auto; }

.search-form { flex: 1 1 320px; position: relative; max-width: 520px; }
.search-form input { padding-right: 44px; }
.search-form button {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 1.05rem; padding: 6px 9px; border-radius: 8px;
}
.search-form button:hover { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }

.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1.08rem;
  transition: border-color var(--tr), color var(--tr);
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.badge-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px;
  background: var(--accent); color: #06231d;
  font-size: .7rem; font-weight: 800;
  display: grid; place-items: center;
}

.lang-switch { display: flex; gap: 4px; }
.lang-switch a {
  padding: 6px 9px; border-radius: 8px;
  font-size: .8rem; font-weight: 700; text-transform: uppercase;
  color: var(--muted); border: 1px solid transparent;
}
.lang-switch a.active { color: var(--primary); border-color: var(--border); background: var(--input-bg); }

/* Основная навигация */
.nav { display: flex; align-items: center; gap: 4px; padding-bottom: 11px; flex-wrap: wrap; }
.nav a {
  padding: 8px 14px;
  border-radius: calc(var(--radius) * 1px);
  color: var(--muted);
  font-weight: 600;
  font-size: .93rem;
  transition: background var(--tr), color var(--tr);
}
.nav a:hover, .nav a.active { background: var(--input-bg); color: var(--primary); }

.burger { display: none; }

/* ------------------------- Слайдер ------------------------- */
.hero { margin-bottom: 34px; }
.slider {
  position: relative;
  border-radius: calc(var(--radius) * 1.4px);
  overflow: hidden;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  min-height: 260px;
}
.slide {
  display: none;
  min-height: 260px;
  padding: 44px;
  align-items: center;
  background-size: cover;
  background-position: center;
  position: relative;
}
.slide.active { display: flex; animation: fadeIn .45s ease; }
.slide::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.62), rgba(0,0,0,.18));
}
.slide-inner { position: relative; z-index: 2; max-width: 560px; }
.slide h2 { color: #fff; font-size: clamp(1.4rem, 3.4vw, 2.4rem); margin-bottom: .35em; }
.slide p { color: rgba(255,255,255,.9); font-size: 1.05rem; margin-bottom: 1.3em; }

.slider-dots { position: absolute; bottom: 16px; left: 44px; display: flex; gap: 8px; z-index: 3; }
.slider-dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: rgba(255,255,255,.45); cursor: pointer; transition: var(--tr);
}
.slider-dots span.active { background: #fff; width: 26px; border-radius: 5px; }

.slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 3;
  width: 42px; height: 42px;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,.4); color: #fff;
  cursor: pointer; font-size: 1.2rem;
}
.slider-arrow:hover { background: rgba(0,0,0,.65); }
.slider-arrow.prev { left: 14px; }
.slider-arrow.next { right: 14px; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ------------------------- Сетка товаров ------------------------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: var(--gap);
}
.products.list { grid-template-columns: 1fr; }

.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--tr), border-color var(--tr), box-shadow var(--tr);
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}

.product-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 26%, var(--card)), var(--card));
  display: grid; place-items: center;
  overflow: hidden;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .ph-icon { font-size: 2.7rem; opacity: .55; }

.product-labels { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 5px; z-index: 2; }
.label {
  padding: 4px 9px;
  border-radius: 7px;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #fff;
}
.label-hit { background: #ff7043; }
.label-new { background: var(--accent); color: #06231d; }
.label-sale { background: #e74c5e; }

.product-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-cat { font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.product-title { font-size: .97rem; font-weight: 700; line-height: 1.35; margin: 0; }
.product-title a { color: var(--text); }
.product-title a:hover { color: var(--primary); }

.product-meta { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); }
.stars { color: #f5b942; letter-spacing: 1px; }

.product-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.price-box { display: flex; flex-direction: column; }
.price { font-size: 1.14rem; font-weight: 800; color: var(--text); }
.price-old { font-size: .82rem; color: var(--muted); text-decoration: line-through; }

.stock-ok { color: var(--accent); font-size: .78rem; font-weight: 700; }
.stock-no { color: #e74c5e; font-size: .78rem; font-weight: 700; }

/* ------------------------- Категории плитками ------------------------- */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 34px;
}
.cat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  padding: 20px 16px;
  text-align: center;
  transition: var(--tr);
  color: var(--text);
}
.cat-tile:hover { border-color: var(--primary); transform: translateY(-3px); color: var(--text); }
.cat-tile .ico { font-size: 2rem; margin-bottom: 8px; }
.cat-tile .nm { font-weight: 700; font-size: .95rem; }
.cat-tile .cnt { font-size: .78rem; color: var(--muted); margin-top: 3px; }

/* ------------------------- Каталог: сайдбар + фильтры ------------------------- */
.catalog-layout { display: grid; grid-template-columns: 260px 1fr; gap: 26px; align-items: start; }

.sidebar { position: sticky; top: 130px; display: flex; flex-direction: column; gap: 18px; }
.sidebar-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  padding: 18px;
}
.sidebar-block h4 { font-size: .95rem; margin-bottom: 13px; }

.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cat-list a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
}
.cat-list a:hover, .cat-list a.active { background: var(--input-bg); color: var(--primary); }
.cat-list .c-cnt { margin-left: auto; font-size: .75rem; opacity: .7; font-weight: 500; }

.price-inputs { display: flex; align-items: center; gap: 8px; }
.price-inputs input { padding: 9px 10px; }

.filter-toggle { display: none; }

.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.toolbar .count { color: var(--muted); font-size: .88rem; }
.toolbar select { width: auto; min-width: 185px; padding: 9px 12px; }
.toolbar .spacer { margin-left: auto; }

#catalogResults { min-height: 200px; transition: opacity .15s; }
#catalogResults.loading { opacity: .45; pointer-events: none; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty .ico { font-size: 3rem; margin-bottom: 12px; }

/* ------------------------- Страница товара ------------------------- */
.breadcrumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: .84rem; color: var(--muted); margin-bottom: 20px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }

.product-page { display: grid; grid-template-columns: 400px 1fr; gap: 32px; align-items: start; }
.product-gallery {
  border-radius: calc(var(--radius) * 1.2px);
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 22%, var(--card)), var(--card));
}
.product-gallery .main-img { aspect-ratio: 3/4; display: grid; place-items: center; }
.product-gallery .main-img img { width: 100%; height: 100%; object-fit: cover; }
.product-gallery .ph-icon { font-size: 4.5rem; opacity: .5; }
.gallery-thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.gallery-thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.gallery-thumbs img.active { border-color: var(--primary); }

.pp-title { margin-bottom: 12px; }
.pp-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; font-size: .88rem; color: var(--muted); }
.pp-meta b { color: var(--text); font-weight: 600; }

.buy-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  padding: 22px;
  margin-bottom: 24px;
}
.buy-price { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.buy-price .p-now { font-size: 2rem; font-weight: 800; }
.buy-price .p-old { font-size: 1.05rem; color: var(--muted); text-decoration: line-through; }
.buy-price .p-off {
  background: #e74c5e; color: #fff;
  padding: 3px 9px; border-radius: 7px;
  font-size: .78rem; font-weight: 800;
}
.buy-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.qty-input { display: flex; align-items: center; border: 1px solid var(--border); border-radius: calc(var(--radius) * 1px); overflow: hidden; }
.qty-input button { width: 38px; height: 44px; border: 0; background: var(--input-bg); color: var(--text); cursor: pointer; font-size: 1.1rem; }
.qty-input button:hover { color: var(--primary); }
.qty-input input { width: 54px; border: 0; text-align: center; border-radius: 0; background: var(--card); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button {
  padding: 11px 18px;
  border: 0; background: none;
  color: var(--muted);
  font: inherit; font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .25s; }

.content-body { line-height: 1.7; }
.content-body ul, .content-body ol { padding-left: 22px; }
.content-body li { margin-bottom: 6px; }
.content-body img { border-radius: 10px; margin: 12px 0; }

/* ------------------------- Отзывы ------------------------- */
.review {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.review:last-child { border-bottom: 0; }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.review-author { font-weight: 700; }
.review-date { font-size: .8rem; color: var(--muted); margin-left: auto; }

/* ------------------------- Корзина ------------------------- */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 26px; align-items: start; }

.cart-row {
  display: grid;
  grid-template-columns: 74px 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.cart-row:last-child { border-bottom: 0; }
.cart-thumb {
  width: 74px; aspect-ratio: 3/4;
  border-radius: 9px; overflow: hidden;
  background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 24%, var(--card)), var(--card));
  display: grid; place-items: center;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-name { font-weight: 700; font-size: .95rem; }
.cart-name a { color: var(--text); }
.cart-sum { font-weight: 800; min-width: 92px; text-align: right; }
.cart-del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.15rem; padding: 6px; }
.cart-del:hover { color: #e74c5e; }

.summary { position: sticky; top: 130px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: .93rem; }
.summary-row.total {
  border-top: 1px solid var(--border);
  margin-top: 8px; padding-top: 15px;
  font-size: 1.2rem; font-weight: 800;
}
.promo-form { display: flex; gap: 8px; margin: 14px 0; }

/* ------------------------- Личный кабинет ------------------------- */
.account-layout { display: grid; grid-template-columns: 235px 1fr; gap: 26px; align-items: start; }
.account-nav { display: flex; flex-direction: column; gap: 3px; }
.account-nav a {
  padding: 11px 14px;
  border-radius: calc(var(--radius) * 1px);
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  display: flex; align-items: center; gap: 9px;
}
.account-nav a:hover, .account-nav a.active { background: var(--card); color: var(--primary); }

.user-head { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1.35rem;
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------- Таблицы ------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { padding: 12px 13px; text-align: left; border-bottom: 1px solid var(--border); }
table.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; white-space: nowrap; }
table.tbl tbody tr:hover { background: var(--input-bg); }
table.tbl td.num, table.tbl th.num { text-align: right; }

.status {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-new      { background: rgba(245,185,66,.18); color: #f5b942; }
.status-pending  { background: rgba(66,153,245,.18); color: #4299f5; }
.status-paid     { background: rgba(0,210,168,.18);  color: #00d2a8; }
.status-canceled { background: rgba(231,76,94,.18);  color: #e74c5e; }
.status-refunded { background: rgba(150,150,150,.2); color: #999; }

/* Ключи */
.key-box {
  background: var(--input-bg);
  border: 1px dashed var(--border);
  border-radius: 9px;
  padding: 11px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9rem;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  word-break: break-all;
}
.key-box .copy-btn { margin-left: auto; flex-shrink: 0; }

/* Ожидание отложенной выдачи («под заказ») */
.issue-wait {
  display: flex; gap: 12px; align-items: flex-start;
  background: rgba(66,153,245,.1);
  border: 1px solid rgba(66,153,245,.3);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.issue-wait-spin { font-size: 1.6rem; line-height: 1; }
.issue-wait-until { font-weight: 700; color: var(--accent); }

/* ------------------------- Розыгрыши ------------------------- */
.giveaway-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.giveaway-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  overflow: hidden;
  transition: var(--tr);
}
.giveaway-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.giveaway-banner {
  height: 145px;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  font-size: 2.6rem;
  color: #fff;
  position: relative;
}
.giveaway-banner img { width: 100%; height: 100%; object-fit: cover; }
.giveaway-banner-ico { display: grid; place-items: center; opacity: .9; }

.gv-status-badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 700;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(3px);
}
.giveaway-card.gv-inactive, .giveaway-card.gv-finished { opacity: .68; }
.gv-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: .5px; }
.gv-platform { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.gv-timer { font-size: .8rem; color: var(--accent); font-weight: 600; }

.progress-bar { height: 8px; border-radius: 5px; background: var(--input-bg); overflow: hidden; margin: 10px 0 6px; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 5px; transition: width .4s; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.task-item {
  display: flex; align-items: center; gap: 13px;
  padding: 15px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  transition: var(--tr);
}
.task-item.done { border-color: var(--accent); }
.task-check {
  width: 27px; height: 27px; border-radius: 50%;
  border: 2px solid var(--border);
  display: grid; place-items: center;
  font-size: .8rem; flex-shrink: 0;
}
.task-item.done .task-check { background: var(--accent); border-color: var(--accent); color: #06231d; }
.task-info { flex: 1; min-width: 0; }
.task-info .t-nm { font-weight: 700; font-size: .94rem; }
.task-info .t-tp { font-size: .78rem; color: var(--muted); }

/* ------------------------- Уведомления ------------------------- */
.alert {
  padding: 13px 17px;
  border-radius: calc(var(--radius) * 1px);
  margin-bottom: 18px;
  font-size: .92rem;
  border: 1px solid transparent;
  display: flex; align-items: center; gap: 10px;
}
.alert-ok   { background: rgba(0,210,168,.12); border-color: rgba(0,210,168,.35); color: var(--accent); }
.alert-err  { background: rgba(231,76,94,.12); border-color: rgba(231,76,94,.35); color: #e74c5e; }
.alert-info { background: rgba(66,153,245,.12); border-color: rgba(66,153,245,.35); color: #4299f5; }
.alert-warn { background: rgba(245,185,66,.12); border-color: rgba(245,185,66,.35); color: #f5b942; }

/* Всплывающие тосты */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 9px; max-width: 340px; }
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 11px;
  padding: 13px 17px;
  font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  animation: toastIn .25s ease;
}
.toast.err { border-left-color: #e74c5e; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) } to { opacity: 1; transform: none } }

/* ------------------------- Пагинация ------------------------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination .dots {
  min-width: 40px; height: 40px;
  display: grid; place-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .dots { border-color: transparent; }

/* ------------------------- Формы авторизации ------------------------- */
.auth-wrap { max-width: 430px; margin: 40px auto; }
.social-buttons { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px;
  border-radius: calc(var(--radius) * 1px);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-weight: 600;
}
.social-btn:hover { border-color: var(--primary); color: var(--text); }
.social-btn.vk { border-color: #07f; }
.social-btn.google { border-color: #ea4335; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: .84rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ------------------------- Подвал ------------------------- */
.footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 30px; margin-bottom: 30px; }
.footer h5 { font-size: .88rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 13px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: var(--text); font-size: .9rem; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: .85rem; color: var(--muted);
}

.messengers { display: flex; gap: 9px; flex-wrap: wrap; }
.messengers a {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  font-size: 1.1rem;
  transition: var(--tr);
}
.messengers a:hover { border-color: var(--primary); transform: translateY(-2px); }
.messenger-vk { font-size: .82rem !important; font-weight: 800; letter-spacing: .02em; }

.social-widget { border-radius: calc(var(--radius) * 1px); overflow: hidden; }
.social-widget iframe { max-width: 100%; border: 0; }

/* ------------------------- Прочее ------------------------- */
.banner { margin: 0 0 20px; }
.banner-header { text-align: center; font-size: .9rem; }

.maintenance {
  min-height: 100vh;
  display: grid; place-items: center;
  text-align: center; padding: 20px;
}
.maintenance .ico { font-size: 4.5rem; margin-bottom: 18px; }

.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 10px } .mt-2 { margin-top: 20px } .mt-3 { margin-top: 30px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 10px } .mb-2 { margin-bottom: 20px } .mb-3 { margin-bottom: 30px }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hide { display: none !important; }

/* ------------------------- Адаптив ------------------------- */
@media (max-width: 1024px) {
  .product-page { grid-template-columns: 320px 1fr; gap: 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .filter-toggle { display: inline-flex; }
  .sidebar.collapsed { display: none; }
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .account-layout { grid-template-columns: 1fr; }
  .account-nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .account-nav a { white-space: nowrap; }
}

@media (max-width: 768px) {
  .product-page { grid-template-columns: 1fr; }
  .product-gallery { max-width: 340px; margin: 0 auto; }
  .header-top { flex-wrap: wrap; gap: 10px; }
  .search-form { order: 3; flex-basis: 100%; max-width: none; }
  .nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 10px; }
  .nav a { white-space: nowrap; }
  .slide { padding: 28px 22px; min-height: 220px; }
  .slider-dots { left: 22px; }
  .slider-arrow { display: none; }
  .products { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 13px; }
  .cats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .cart-row { grid-template-columns: 60px 1fr auto; row-gap: 10px; }
  .cart-row .cart-sum { grid-column: 2 / 4; text-align: left; }
  .buy-price .p-now { font-size: 1.6rem; }
  .products { grid-template-columns: repeat(2, 1fr); }
  #toasts { left: 12px; right: 12px; max-width: none; }
  .table-wrap table.tbl { font-size: .84rem; }
  table.tbl th, table.tbl td { padding: 10px 9px; }
}

@media print {
  .header, .footer, .btn, #toasts { display: none !important; }
}

/* Атрибут hidden должен побеждать любые display-правила компонентов ниже —
   без этого .cookie-banner/.chat-panel остаются видимыми даже после hidden=true
   (та же специфичность, что и у UA-правила [hidden], но автор побеждает по origin) */
[hidden] { display: none !important; }

/* ------------------------- Cookie-баннер ------------------------- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  z-index: 9990;
  max-width: 640px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
}
.cookie-banner-text { flex: 1 1 260px; font-size: .86rem; color: var(--muted); }
.cookie-banner-text a { color: var(--primary); }

/* ------------------------- Виджет чата поддержки ------------------------- */
.chat-widget { position: fixed; right: 20px; bottom: 96px; z-index: 9980; }
.chat-bubble {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: 0;
  font-size: 1.4rem; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,.3);
  display: grid; place-items: center; position: relative;
}
.chat-bubble:hover { filter: brightness(1.1); }
.chat-dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: #e74c5e; border: 2px solid var(--bg); }

.chat-panel {
  position: absolute; right: 0; bottom: 70px;
  width: min(340px, 90vw); max-height: 480px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1px);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  overflow: hidden;
}
.chat-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; background: var(--primary); color: #fff; font-weight: 700;
}
.chat-x { background: none; border: 0; color: #fff; font-size: 1rem; cursor: pointer; opacity: .85; }
.chat-x:hover { opacity: 1; }

.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 140px; max-height: 300px; }
.chat-greeting { font-size: .87rem; color: var(--muted); }
.chat-msg { max-width: 85%; }
.chat-msg.from-admin { align-self: flex-start; }
.chat-msg.from-user { align-self: flex-end; }
.chat-msg-bubble { padding: 9px 12px; border-radius: 12px; font-size: .87rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-msg.from-admin .chat-msg-bubble { background: var(--input-bg); border: 1px solid var(--border); }
.chat-msg.from-user .chat-msg-bubble { background: var(--primary); color: #fff; }
.chat-msg-time { font-size: .72rem; color: var(--muted); margin-top: 3px; text-align: right; }

.chat-form { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.chat-form-inline { flex-direction: row; align-items: flex-end; }
.chat-input {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  font: inherit; font-size: .87rem;
}
.chat-textarea { min-height: 46px; resize: none; flex: 1; }
.chat-consent-hint { font-size: .72rem; color: var(--muted); line-height: 1.4; }
.chat-consent-hint a { color: var(--muted); text-decoration: underline; }
.chat-consent-hint a:hover { color: var(--primary); }

@media (max-width: 560px) {
  .chat-widget { right: 12px; bottom: 84px; }
  .chat-panel { position: fixed; right: 10px; left: 10px; bottom: 80px; width: auto; }
}

/* Honeypot-ловушка от ботов: скрыта от людей, но остаётся в DOM для скриптов, заполняющих поля вслепую */
.bot-trap { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
