/* Страницы магазина и админки (каталог, товар, корзина, управление) поверх style.css: те же токены, рамки 1.5px,
   прямые углы, моно-текст и заголовки Dela Gothic. Подключается после style.css. CSP: только классы, без style="". */

/* шапка: поиск и корзина — теперь ссылки */
a.hdr-icon, a.hdr-cart { cursor: pointer; }
a.hdr-icon:hover { color: var(--pink); }
a.hdr-cart:hover { background: var(--ink); }
.hdr-nav a[aria-current="page"] { color: var(--pink); }

/* ---------- каркас страницы ---------- */
.shop { padding: 56px var(--pad) 80px; border-bottom: 1.5px solid var(--line); }
.shop-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 28px; }
.shop-head h1 { font: 400 56px/1 var(--display); text-transform: uppercase; }
.shop-head .lead { margin-top: 12px; max-width: 52ch; color: var(--muted); }
.crumbs { margin-bottom: 18px; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--pink); }
[hidden] { display: none !important; }

/* ---------- поля и кнопки ---------- */
.fld { display: grid; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fld input, .fld select, .fld textarea, .inp {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 0;
  background: rgba(11, 11, 12, .35); color: var(--ink); font: 15px var(--mono); text-transform: none; letter-spacing: 0;
}
.fld textarea { min-height: 120px; padding: 10px 14px; resize: vertical; }
.fld select, select.inp { padding-right: 8px; }
.fld option { background: var(--black); color: var(--ink); }
.fld input:focus, .fld select:focus, .fld textarea:focus, .inp:focus { outline: none; border-color: var(--pink); }
.fld-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; text-transform: none; color: var(--ink); cursor: pointer; }
.fld-check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--pink); }
.cta-s { min-height: 44px; padding: 0 16px; font-size: 12px; }
.ghost { min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line); background: none; color: var(--ink); font-size: 12px; font-weight: 700; text-transform: uppercase; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ghost:hover { color: var(--pink); border-color: var(--pink); }
.ghost:disabled, .cta:disabled { opacity: .45; cursor: not-allowed; }
.danger:hover { color: #ff8a7a; border-color: #ff8a7a; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.row > .fld { flex: 1 1 180px; }
.msg { min-height: 1.5em; font-size: 14px; color: #ff8a7a; }
.msg.ok { color: var(--pink); }
.msg:empty { min-height: 0; }
.note { font-size: 14px; color: var(--muted); }
.note a { color: var(--pink); }
.muted-s { font-size: 12px; color: var(--muted); }

/* ---------- каталог: фильтры, сетка карточек, страницы ---------- */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; gap: 12px; align-items: end; margin-bottom: 24px; }
.filters .actions { display: flex; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.pcard { display: flex; flex-direction: column; border: 1.5px solid var(--black); background: var(--ink); color: var(--black); box-shadow: 0 14px 26px -8px rgba(0, 0, 0, .55); }
.pcard-link { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 12px; color: inherit; text-decoration: none; }
.pcard-link:hover .pcard-name { color: var(--pink-text); }
.pcard-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; text-transform: uppercase; }
.pcard-code { padding: 2px 7px; background: var(--pink); color: var(--black); font-weight: 700; overflow-wrap: anywhere; }
.pcard .pic { margin: 12px 0; aspect-ratio: 3 / 4; }
.pcard-name { font-size: 13px; font-weight: 700; text-transform: uppercase; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 14px; }
.price { font-weight: 700; font-size: 15px; box-shadow: inset 0 -6px 0 var(--pink); }
.old { margin-left: 8px; font-size: 12px; color: var(--card-muted); text-decoration: line-through; }
.pcard .cta-s { border-color: var(--black); background: var(--black); color: var(--ink); }
.pcard .cta-s:hover { background: var(--pink); color: var(--black); }
.pcard .msg { padding: 0 16px 10px; font-size: 12px; color: #c0392b; }
.pcard .msg.ok { color: var(--pink-text); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; font-size: 13px; text-transform: uppercase; }
.pager .actions { display: flex; gap: 8px; }
.empty { padding: 40px 20px; border: 1.5px dashed var(--line); text-align: center; color: var(--muted); }

/* картинка товара с заглушкой */
.pic { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; background: rgba(11, 11, 12, .06); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic-stub { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--card-muted); }

/* ---------- товар ---------- */
.product { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 64px; align-items: start; }
.gallery .pic.main { aspect-ratio: 3 / 4; border: 1.5px solid var(--line); background: var(--ink); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs button { width: 64px; padding: 0; border: 1.5px solid var(--line-soft); background: var(--ink); cursor: pointer; }
.thumbs button[aria-pressed="true"] { border-color: var(--pink); }
.thumbs .pic { aspect-ratio: 3 / 4; }
.product h1 { font: 400 34px/1.05 var(--display); text-transform: uppercase; }
.product .code { display: inline-block; margin-bottom: 14px; padding: 2px 8px; background: var(--pink); color: var(--black); font-size: 12px; font-weight: 700; }
.product .price-big { margin-top: 20px; font: 400 40px/1 var(--display); }
.product .price-big .old { font: 15px var(--mono); color: var(--muted); }
.specs { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 24px 0 0; padding-top: 18px; border-top: 1.5px solid var(--line-soft); }
.specs dt { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.specs dd { margin: 0; overflow-wrap: anywhere; }
.buy { margin-top: 28px; display: grid; gap: 12px; }

/* количество: − [n] + */
.qty { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line); }
.qty button { width: 44px; min-height: 44px; border: 0; background: none; color: var(--ink); font: 700 18px var(--mono); cursor: pointer; }
.qty button:hover:not(:disabled) { background: var(--pink); color: var(--black); }
.qty button:disabled { opacity: .4; cursor: not-allowed; }
.qty input { width: 64px; border: 0; border-left: 1.5px solid var(--line); border-right: 1.5px solid var(--line); background: none; color: var(--ink); font: 700 15px var(--mono); text-align: center; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button, .qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; background: rgba(255, 127, 174, .15); }

/* ---------- корзина ---------- */
.cart { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.cart-list { border-top: 1.5px solid var(--line); }
.cart-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto auto auto; gap: 16px 20px; align-items: center; padding: 16px 0; border-bottom: 1.5px solid var(--line-soft); }
.cart-row .pic { aspect-ratio: 3 / 4; background: var(--ink); }
.cart-name { font-weight: 700; text-transform: uppercase; font-size: 13px; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-name:hover { color: var(--pink); }
.cart-sum { min-width: 9ch; text-align: right; font-weight: 700; }
.cart-row .msg { grid-column: 2 / -1; }
.summary { position: sticky; top: 16px; padding: 22px; border: 1.5px solid var(--line); display: grid; gap: 14px; }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; font: 400 30px/1 var(--display); }
.summary .cta { justify-content: center; }

/* ---------- управление ---------- */
.seg { display: flex; flex-wrap: wrap; border: 1.5px solid var(--line); width: max-content; max-width: 100%; margin-bottom: 24px; }
.seg button { min-height: 44px; padding: 0 18px; border: 0; background: none; color: var(--ink); font-size: 13px; font-weight: 700; text-transform: uppercase; cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--pink); color: var(--black); }
.panel { display: grid; gap: 22px; }
.box { padding: 20px; border: 1.5px solid var(--line); display: grid; gap: 14px; }
.box h2, .box h3 { font: 400 22px/1.1 var(--display); text-transform: uppercase; }
.box-dashed { border-style: dashed; }
.tbl-wrap { overflow-x: auto; border: 1.5px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1.5px solid var(--line-soft); text-align: left; vertical-align: middle; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.is-sel td { background: rgba(255, 127, 174, .12); }
.tbl td.acts { white-space: nowrap; text-align: right; }
.tbl td.acts > * + * { margin-left: 6px; }
.tbl .inp { min-height: 38px; }
.tag { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 7px; border: 1.5px solid var(--line-soft); font-size: 12px; }
.tag-pink { border-color: var(--pink); color: var(--pink); }
.perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; }
.perm { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; }
.perm input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--pink); }
.perm select { min-height: 30px; padding: 0 4px; border: 1.5px solid var(--line-soft); background: var(--black); color: var(--ink); font: 12px var(--mono); }
.perm select:disabled { opacity: .35; }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; border: 1.5px solid var(--pink); }
.secret code { flex: 1 1 260px; overflow-wrap: anywhere; font-size: 14px; }
.pre { max-height: 420px; overflow: auto; margin: 0; padding: 14px; border: 1.5px solid var(--line-soft); background: rgba(11, 11, 12, .45); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.admin-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.admin-link { display: grid; gap: 8px; padding: 22px; border: 1.5px solid var(--line); text-decoration: none; }
.admin-link:hover { border-color: var(--pink); }
.admin-link b { font: 400 26px/1 var(--display); text-transform: uppercase; }
.admin-link span { font-size: 13px; color: var(--muted); }
.cabinet-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cart { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 760px) {
  .shop { padding: 36px var(--pad) 56px; }
  .shop-head h1 { font-size: 36px; }
  .filters { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pcard-link { padding: 10px 10px 8px; }
  .pcard-bottom { flex-direction: column; align-items: stretch; padding: 0 10px 10px; }
  .product { grid-template-columns: 1fr; }
  .product h1 { font-size: 24px; }
  .cart-row { grid-template-columns: 64px minmax(0, 1fr); }
  .cart-row .qty, .cart-row .cart-sum, .cart-row .del { grid-column: 2; justify-self: start; }
  .tbl { font-size: 13px; }
}

/* ---------- каталог (catalog.js): поиск в панели фильтров, «В корзину» под карточкой ---------- */
.cat-q { flex: 1 1 260px; }
.cat-q input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 0; background: var(--black); color: var(--ink); font: 14px var(--mono); text-transform: none; }
.cat-q input:focus { outline: none; border-color: var(--pink); }
.cat-q + .cat-field { border-left: 1.5px solid var(--line); }
li.card { display: flex; flex-direction: column; }
li.card > .card-link { flex: 1; height: auto; }
.card-actions { display: grid; gap: 4px; margin-top: 8px; }
.card-cart { min-height: 44px; border: 1.5px solid var(--line); background: var(--black); color: var(--ink); font: 700 12px var(--mono); text-transform: uppercase; cursor: pointer; }
.card-cart:hover:not(:disabled) { background: var(--pink); border-color: var(--pink); color: var(--black); }
.card-cart:disabled { opacity: .5; cursor: progress; }
.card-cart-msg { min-height: 1.4em; font-size: 12px; color: var(--muted); }
.card-cart-msg a { color: var(--pink); }
.thumbs .thumb { width: 64px; border: 1.5px solid var(--line-soft); background: var(--ink); }
.thumbs .thumb .pic { aspect-ratio: 3 / 4; }

/* ---------- главная: лента на товарах бэка (main.js) — фото карточки вместо мокапа и заглушка, как в каталоге ---------- */
.hits .card-photo { padding: 12px 0 14px; }
.hits .card-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: none; }
.hits .card-nopic { align-items: center; min-height: 260px; margin: 12px 0 14px; border: 1.5px dashed var(--card-muted); color: var(--card-muted); font-size: 12px; text-transform: uppercase; text-align: center; padding: 0 12px; }
