/* ── Переменные ─────────────────────────────────────────── */
:root {
  --blue:   #0C5DA5;
  --gold:   #C9A227;
  --bg:     #f7f7f7;
  --card-bg:#ffffff;
  --text:   #1a1a1a;
  --muted:  #888888;
  --radius: 10px;
  --gap:    8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ── Шапка ──────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 12px 10px;
  background: var(--blue);
  color: #fff;
}
.header__title {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.5px;
}
.header__sub { font-size: 12px; opacity: 0.75; }

/* ── Табы ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #e8e8e8;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  flex: 1;
  min-width: 80px;
  padding: 10px 8px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab--active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

/* ── Фильтры ────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}
.filter-select {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  background: #fafafa;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

/* ── Сообщения ──────────────────────────────────────────── */
.error-msg {
  margin: 16px 12px;
  padding: 12px 14px;
  background: #fff3cd;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}
.empty-msg {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ── Лоадер ─────────────────────────────────────────────── */
.loader {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}
.loader__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #ddd;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Сетка ──────────────────────────────────────────────── */
.catalog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  padding: var(--gap);
}

/* ── Карточка ───────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card__img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f0f0f0;
  overflow: hidden;
}
.card__img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card__body {
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.card__brand {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--blue);
  font-weight: 600;
}
.card__name {
  font-family: Georgia, serif;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  flex: 1;
}
.card__prices {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.card__price { font-size: 13px; font-weight: 700; }
.card__old-price { font-size: 11px; color: var(--muted); text-decoration: line-through; }

/* ── Экран товара ───────────────────────────────────────── */
.product-screen {
  min-height: 100vh;
  background: var(--bg);
}
.product-topbar {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  position: sticky;
  top: 0;
  z-index: 10;
}
.back-btn {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
}

/* ── Галерея ────────────────────────────────────────────── */
.gallery { width: 100%; overflow: hidden; }
.gallery__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery__track::-webkit-scrollbar { display: none; }
.gallery__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  aspect-ratio: 1 / 1;
  background: #f0f0f0;
}
.gallery__img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Инфо товара ────────────────────────────────────────── */
.product-info {
  padding: 16px 12px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.product-info__brand {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--blue);
  font-weight: 600;
}
.product-info__name {
  font-family: Georgia, serif;
  font-size: 18px;
  line-height: 1.3;
  font-weight: normal;
}
.product-info__prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.product-info__price { font-size: 20px; font-weight: 700; }
.product-info__old   { font-size: 14px; color: var(--muted); text-decoration: line-through; }

/* ── Размеры ────────────────────────────────────────────── */
.sizes__label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sizes__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.size-chip {
  padding: 6px 14px;
  border: 1.5px solid #ddd;
  border-radius: 20px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.size-chip--active {
  border-color: var(--gold);
  background: var(--gold);
  color: #fff;
  font-weight: 600;
}

/* ── Блок текста ────────────────────────────────────────── */
.product-info__block { display: flex; flex-direction: column; gap: 4px; }
.product-info__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.product-info__text {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

/* ── Кнопка корзины ─────────────────────────────────────── */
.cart-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  margin-top: 8px;
}
.cart-btn--disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
}

/* ── Иконка корзины в шапке ─────────────────────────────── */
.header { position: relative; }
.cart-icon {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  position: relative;
  padding: 0 4px;
  line-height: 1;
}
.cart-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  background: var(--gold);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ── Заголовок топбара ──────────────────────────────────── */
.topbar-title {
  font-family: Georgia, serif;
  font-size: 16px;
  margin-left: 12px;
  color: var(--text);
}

/* ── Экран корзины ──────────────────────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 24px 32px;
  gap: 12px;
}
.cart-empty__icon { font-size: 48px; }
.cart-empty__text { font-size: 16px; color: var(--muted); }

.cart-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.cart-item__img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f0f0;
  flex-shrink: 0;
}
.cart-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cart-item__brand {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.cart-item__name {
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item__size { font-size: 12px; color: var(--muted); }
.cart-item__price { font-size: 14px; font-weight: 700; margin-top: 2px; }

.cart-item__controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.qty-val { font-size: 14px; font-weight: 600; min-width: 16px; text-align: center; }
.remove-btn {
  font-size: 11px;
  color: #cc3333;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
}

.cart-footer {
  padding: 12px 12px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid #e8e8e8;
  margin-top: 4px;
}
.cart-footer__summary {
  font-size: 14px;
  color: var(--text);
  text-align: center;
}

/* ── Иконка корзины в шапке ──────────────────────────────── */
.cart-icon {
  margin-left: auto;
  position: relative;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gold);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ── Шапка товара / корзины ──────────────────────────────── */
.topbar-title {
  font-family: Georgia, serif;
  font-size: 16px;
  margin-left: 8px;
}

/* ── Список позиций корзины ──────────────────────────────── */
.cart-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.cart-item__img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f0f0;
  flex-shrink: 0;
}
.cart-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cart-item__brand {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.cart-item__name {
  font-family: Georgia, serif;
  font-size: 12px;
  line-height: 1.3;
}
.cart-item__size {
  font-size: 11px;
  color: var(--muted);
}
.cart-item__price {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}
.cart-item__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.qty-val {
  font-size: 14px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.remove-btn {
  background: none;
  border: none;
  font-size: 11px;
  color: #e04040;
  cursor: pointer;
  padding: 0;
}

/* ── Итого + кнопка оформления ───────────────────────────── */
.cart-footer {
  padding: 12px;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  bottom: 0;
}
.cart-summary {
  display: flex;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.cart-summary__total {
  font-weight: 700;
  color: var(--text);
}

/* ── Пустая корзина ─────────────────────────────────────── */
.empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 24px;
  gap: 12px;
}
.empty-cart__icon { font-size: 48px; opacity: 0.3; }
.empty-cart__text { font-size: 16px; color: var(--muted); }
.back-to-catalog-btn {
  margin-top: 8px;
  padding: 10px 24px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
}

/* ── Форма оформления ────────────────────────────────────── */
.checkout-form {
  padding: 16px 12px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.form-input {
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
.form-input--sub { margin-top: 8px; }
.form-textarea { min-height: 72px; resize: none; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--blue); }

.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.radio-item input[type=radio] { accent-color: var(--blue); width: 18px; height: 18px; }
.radio-hint { font-size: 12px; color: var(--muted); margin-left: 26px; margin-top: -6px; }

.form-error {
  padding: 10px 14px;
  background: #fde8e8;
  border-left: 4px solid #e04040;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #c00;
}

/* ── Итого в форме ───────────────────────────────────────── */
.checkout-total {
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.checkout-total__row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
}
.checkout-total__row--total {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  padding-top: 6px;
  border-top: 1px solid #e8e8e8;
  margin-top: 2px;
}

/* ── Экран успеха ────────────────────────────────────────── */
.success-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.success-body {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  max-width: 360px;
}
.success-icon { font-size: 56px; }
.success-title { font-family: Georgia, serif; font-size: 20px; }
.success-info { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.success-label { font-size: 13px; color: var(--muted); }
.success-amount { font-size: 24px; font-weight: 700; }
.success-requisite {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  padding: 10px;
  background: #f0f5ff;
  border-radius: 8px;
}

/* ── Иконки в шапке ─────────────────────────────────────── */
.header__actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.header-icon {
  background: none; border: none; font-size: 20px;
  cursor: pointer; padding: 4px; opacity: 0.85;
}

/* ── Список заказов ─────────────────────────────────────── */
.orders-list { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.order-card {
  background: #fff; border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  display: flex; flex-direction: column; gap: 6px;
}
.order-card__head { display: flex; justify-content: space-between; align-items: center; }
.order-card__num  { font-family: Georgia, serif; font-size: 15px; font-weight: bold; }
.order-card__status {
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  background: #f0f0f0; color: var(--muted);
}
.status--new       { background: #fff3cd; color: #856404; }
.status--confirmed { background: #d1e7dd; color: #0a3622; }
.status--paid      { background: #cfe2ff; color: #084298; }
.status--shipped   { background: #e2d9f3; color: #432874; }
.status--done      { background: #d1e7dd; color: #0a3622; }

.order-card__meta {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted);
}
.order-card__total { font-weight: 600; color: var(--text); }
.order-card__paid-hint {
  font-size: 11px; color: #856404; background: #fff3cd;
  padding: 3px 8px; border-radius: 6px; align-self: flex-start;
}

/* ── Детали заказа ──────────────────────────────────────── */
.order-detail-info {
  padding: 12px 12px 48px;
  display: flex; flex-direction: column; gap: 10px;
}
.detail-row {
  display: flex; justify-content: space-between;
  font-size: 14px; padding: 6px 0;
  border-bottom: 1px solid #f0f0f0;
}
.detail-row--total {
  font-weight: 700; font-size: 16px;
  border-bottom: none; padding-top: 8px;
}
.detail-label { color: var(--muted); flex-shrink: 0; margin-right: 8px; }
.paid-status {
  font-size: 13px; color: #0a3622;
  background: #d1e7dd; padding: 10px 12px;
  border-radius: 8px; line-height: 1.5;
}
