/* ===== Магазин и заказы. Подключается после style.css ===== */

/* Сетка товаров */
.shop-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.product { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.product-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--subtle); }
.product-body { display: flex; flex-direction: column; gap: 12px; padding: 18px; flex: 1; }
.product-body h3 { font-size: 16px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; }
.product-desc { color: #c9c9c9; font-size: 14px; white-space: pre-line; }
.product-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: auto; padding-top: 6px;
}

/* Поля количества и поиска */
.qty, .field-input, .inline-form select {
  width: 80px;
  padding: 9px 10px;
  background: var(--bg);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
}
.field-input { width: 100%; min-width: 0; }
.qty:focus, .field-input:focus, .inline-form select:focus { outline: none; border-color: #6b6b78; }

.add-form, .inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Корзина */
.cart { display: grid; gap: 14px; max-width: 900px; }
.cart-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cart-info { display: grid; gap: 4px; flex: 1; min-width: 200px; }
.cart-sub { font-weight: 600; min-width: 90px; text-align: right; color: #fff; }
.cart-total { display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.cart-link .cart-count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 10px; background: #fff; color: #000; font-size: 12px; text-align: center;
}

/* Код заказа */
.order-code { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.code {
  display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 28px; letter-spacing: 0.18em; color: #fff;
  padding: 12px 18px; background: var(--bg);
  border: 1px dashed var(--border-hover); border-radius: var(--radius);
  user-select: all;
}
.steps { padding-left: 20px; display: grid; gap: 8px; color: var(--muted); font-size: 14px; margin: 12px 0; }
.steps strong { color: #fff; }
.order-actions { margin-top: 14px; }
.order-status { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.order-table { margin-bottom: 14px; }

.status-badge {
  display: inline-block; padding: 4px 10px; border-radius: 3px; font-size: 13px;
  border: 1px solid var(--border-hover); color: #d4d4d4;
}
.status-paid { color: #34d399; border-color: #1f6b52; }
.status-done { color: #fff; border-color: #fff; }

/* Поиск заказа */
.lookup { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; max-width: 560px; }
.lookup label { display: grid; gap: 6px; flex: 1; min-width: 220px; font-size: 13px; color: var(--muted); }
.hint-top { margin-top: 18px; }

/* Сообщения */
.flash-error { color: #f87171; font-size: 14px; margin: 12px 0; }
.actions, .filters { margin: 16px 0; display: flex; flex-wrap: wrap; gap: 12px; }
.filters a { color: var(--muted); text-decoration: none; font-size: 14px; padding: 4px 0; border-bottom: 1px solid transparent; }
.filters a.on, .filters a:hover { color: #fff; border-bottom-color: #fff; }

/* Админка */
.mini { width: 56px; height: 40px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.admin-form input[type="number"][name="sort"] { width: 120px; }

/* ===== Плавное открытие и закрытие просмотра картинок ===== */
.lightbox {
  display: flex;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0s linear 0s;
}
.lightbox img,
.lightbox p {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.lightbox.open img,
.lightbox.open p {
  opacity: 1;
  transform: scale(1);
}

/* Выпадающий список количества в корзине */
.qty-select {
  width: 96px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, #a3a3a3 50%),
                    linear-gradient(135deg, #a3a3a3 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.qty-select option { background: var(--card); color: #fff; }
.remove-form { margin: 0; }
.remove {
  background: none; border: 0; color: var(--muted);
  font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px;
}
.remove:hover { color: #fff; }

/* Окно «Added to cart» */
.drawer-wrap {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(11, 10, 17, 0.7);
  display: flex; justify-content: flex-end;
  animation: fade-in 0.4s ease both;
}
.drawer {
  width: min(420px, 100%); height: 100%; overflow-y: auto;
  background: var(--card); border-left: 1px solid var(--border);
  padding: 24px; display: flex; flex-direction: column; gap: 20px;
  animation: slide-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h3 { font-size: 16px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; }
.check { color: #34d399; margin-right: 6px; }
.drawer-x { color: var(--muted); font-size: 34px; line-height: 1; text-decoration: none; }
.drawer-x:hover { color: #fff; }
.drawer-item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.drawer-item img, .drawer-item .ph {
  width: 96px; height: 96px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.drawer-info { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.drawer-info strong { color: #fff; text-transform: uppercase; font-size: 15px; }
.drawer-sub { color: var(--muted); font-size: 14px; }
.drawer-sub strong { color: #fff; }
.drawer-actions { display: grid; gap: 10px; margin-top: auto; }
.drawer-actions .btn { text-align: center; }

/* Миниатюра товара в корзине */
.cart-thumb {
  width: 112px; height: 112px; object-fit: cover; flex-shrink: 0;
  border-radius: var(--radius); border: 1px solid var(--border);
}

/* Корзина: заголовок, строки итога, кнопки */
.cart-head { font-size: 16px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; }
.cart-actions { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cart-actions .btn { min-width: 220px; text-align: center; }
.sum-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: #d4d4d4; }
.sum-row:last-of-type { border-bottom: 0; }

/* Логотип в шапке: две картинки вместо текста */
.brand-logo { display: flex; align-items: center; gap: 12px; }
.brand-logo .logo-mark,
.brand-logo .logo-word { display: block; width: auto; }
.brand-logo .logo-mark { height: 40px; }
.brand-logo .logo-word { height: 32px; }
@media (max-width: 860px) {
  .brand-logo .logo-mark { height: 32px; }
  .brand-logo .logo-word { height: 26px; }
}

/* Шапка крупнее: высота, логотип, пункты меню */
.bar { height: 76px; }
.menu { gap: 36px; }
.menu a { font-size: 14px; }
.brand-logo .logo-mark { height: 50px; }
.brand-logo .logo-word { height: 40px; }
@media (max-width: 860px) {
  .brand-logo .logo-mark { height: 40px; }
  .brand-logo .logo-word { height: 32px; }
}

/* Надпись в логотипе: крупнее и чуть ниже знака */
.brand-logo .logo-word { height: 50px; position: relative; top: 10px; }
@media (max-width: 860px) {
  .brand-logo .logo-word { height: 40px; top: 7px; }
}

/* Админка: кнопка удаления, нормальная ширина списка статусов */
.btn.danger { border-color: #7f1d1d; color: #f87171; }
.btn.danger:hover { background: #7f1d1d; color: #fff; border-color: #7f1d1d; }
.inline-form select { width: 170px; }

/* Таблица заказов: шире страница, компактнее ячейки, всё в одну строку */
.admin-main:has(.orders-table) { max-width: 1320px; }
.orders-table th, .orders-table td { padding: 12px 8px; white-space: normal; }
.orders-table .inline-form { flex-wrap: nowrap; gap: 6px; }
.orders-table .inline-form select { width: 150px; }
.orders-table .btn { padding: 8px 12px; }

.orders-table .inline-form input { width: 120px; padding: 8px 10px; background: var(--bg); color: #fff; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 13px; }

/* Вход в админку и безопасность */
.auth-wrap { max-width: 420px; padding-top: 72px; padding-bottom: 80px; }
.auth-wrap h1 { font-size: 22px; margin-bottom: 18px; }
.auth-wrap form { display: grid; gap: 14px; }
.auth-wrap label, .sec-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-wrap input, .sec-form input {
  padding: 10px 12px; background: var(--bg); color: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 15px;
}
.auth-wrap input:focus, .sec-form input:focus { outline: none; border-color: #6b6b78; }
.sec-form { display: grid; gap: 14px; }
.linkish { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; padding: 0; }
.linkish:hover { color: #fff; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; word-break: break-all; color: #fff; }
.qr { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: var(--radius); }
.codes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; color: #fff;
}
.codes div { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
