/*
 * store-base.css — B2B интернет-магазин SBK. Дизайн-система (светлый, Arbuz-style)
 * Свежий, лёгкий, минималистичный. Крупные фото, много воздуха, мягкие тени.
 */

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

:root {
  /* Основные цвета: светлый фон + акцентный зелёный (как у Arbuz/свежие продукты) */
  --bg:         #f7f9fb;
  --surface:    #ffffff;
  --surface-2:  #f1f5f9;

  --text:       #1a1f36;
  --text-2:     #4b5563;
  --muted:      #6b7280;
  --muted-2:    #9ca3af;

  --border:     #e8ebf0;
  --border-2:   #d5d9e0;

  /* Акцент (фирменный): тёплый зелёный SBK */
  --accent:     #2da560;      /* основной */
  --accent-2:   #24894f;      /* hover */
  --accent-bg:  #e8f6ed;      /* очень светлый для badge/highlight */

  --warm:       #f97316;      /* оранжевый для акции */
  --warm-bg:    #fff7ed;

  --success:    #16a34a;
  --warn:       #d97706;
  --danger:     #dc2626;

  --radius:     12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --shadow-sm:  0 1px 3px rgba(15,23,42,.04);
  --shadow:     0 4px 16px rgba(15,23,42,.06);
  --shadow-md:  0 8px 28px rgba(15,23,42,.10);
  --shadow-lg:  0 16px 48px rgba(15,23,42,.14);
}

html {
  scroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Глобально: картинки и media не вылезают за контейнер */
img, video, iframe { max-width: 100%; height: auto; }
/* Позволяем элементам flex/grid сжиматься меньше их контента */
*, *::before, *::after { min-width: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
button { font-family: inherit; cursor: pointer; }

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

/* ── Плашка «демо» ── */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 110;
  background: #1a1f36;
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.demo-banner a { color: #7dd3fc; text-decoration: underline; }
.demo-banner strong { color: #fff; }

/* ── Кнопки ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  transition: all .15s;
  text-decoration: none;
  background: transparent;
  color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

.btn-outline {
  background: #fff;
  color: var(--accent);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 14px; }
.btn-full { width: 100%; }

.btn-icon {
  padding: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
}

/* ── Контейнер ── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Секции ── */
/* Важно: padding-top/bottom, а НЕ shorthand "padding: 40px 0".
 * shorthand сбрасывает и left/right, что ломает container-padding
 * при комбинировании классов <div class="container section">. */
.section { padding-top: 40px; padding-bottom: 40px; }
.section-lg { padding-top: 60px; padding-bottom: 60px; }
.section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title .link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.section-title .link:hover { color: var(--accent-2); }

/* ── Заголовки ── */
h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.2px;
}
h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
h4 { font-size: 14px; }

/* ── Card (product / generic) ── */
.card-white {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  border: 1px solid var(--border);
}

/* ── Бейджи ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.2px;
}
.badge-accent { background: var(--accent-bg); color: var(--accent-2); }
.badge-warm   { background: var(--warm-bg);   color: var(--warm);     }
.badge-muted  { background: var(--surface-2); color: var(--muted);    }
.badge-danger { background: #fee2e2;          color: var(--danger);   }
.badge-new    { background: #dbeafe;          color: #1d4ed8;         }

/* ── Формы ── */
.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,165,96,0.12);
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── Stepper (qty +/-) ── */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}
.qty-stepper button {
  background: #fff;
  border: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-stepper .qty-val {
  min-width: 32px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3000;
  pointer-events: none;
  max-width: 94vw;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  pointer-events: auto;
  animation: toast-up .22s ease-out;
}
.toast-success { background: var(--accent); }
@keyframes toast-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform .18s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; }
.modal-close {
  background: none; border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Empty ── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 14px;
  opacity: 0.5;
}
.empty-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── Utilities ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 22px; }
.wrap { flex-wrap: wrap; }
.mt-md { margin-top: 14px; }
.mb-md { margin-bottom: 14px; }
.mt-lg { margin-top: 24px; }
.mb-lg { margin-bottom: 24px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.fw-bold { font-weight: 700; }
.mono { font-family: 'JetBrains Mono', Consolas, monospace; }
.hidden { display: none !important; }
.center { text-align: center; }

/* ── Fade-in for page switches ── */
.view-in { animation: view-fade .2s ease-out; }
@keyframes view-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .view-in, .toast, .modal { animation: none !important; transition: none !important; }
}

/* ── Customer login (B2B) ── */
.customer-login {
  display: flex; align-items: center;
  margin-right: 10px;
}
.customer-login-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: #fff; color: var(--text);
  border: 1.5px dashed var(--accent); border-radius: 999px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .1s;
}
.customer-login-btn:hover { background: var(--accent-bg); }
.customer-login-btn .ic { font-size: 14px; }
.customer-login-btn .lbl { letter-spacing: .2px; }

.customer-active {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px;
  background: var(--accent); color: #fff;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  max-width: 260px;
}
.customer-active .ic { font-size: 14px; }
.customer-active-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}
.customer-active-city { opacity: .7; font-weight: 400; font-size: 12px; }
.customer-logout {
  background: rgba(255,255,255,.2); color: #fff;
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 14px; font-weight: 700; line-height: 1;
  cursor: pointer; transition: background .15s;
  flex-shrink: 0;
}
.customer-logout:hover { background: rgba(255,255,255,.35); }

@media (max-width: 720px) {
  .customer-login-btn .lbl { display: none; }
  .customer-active-name { max-width: 110px; }
}

.customer-login-modal {
  display: flex; flex-direction: column; gap: 12px;
}
.customer-search-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit;
  outline: none;
}
.customer-search-input:focus { border-color: var(--accent); }
.customer-search-results {
  max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.customer-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid transparent; border-radius: 10px;
  cursor: pointer; text-align: left;
  font-family: inherit; transition: background .15s, border-color .15s;
}
.customer-search-row:hover { background: var(--accent-bg); border-color: var(--accent); }
.customer-search-row.loading { opacity: .5; pointer-events: none; }
.customer-row-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  grid-column: 1;
}
.customer-row-meta {
  grid-column: 1;
  font-size: 11.5px; color: var(--muted);
}
.customer-row-overrides {
  grid-column: 2; grid-row: 1 / span 2;
  font-size: 11px; color: var(--accent-2);
  background: var(--accent-bg);
  padding: 2px 8px; border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}
.customer-search-hint, .customer-search-empty, .customer-search-more {
  padding: 14px; text-align: center;
  font-size: 13px; color: var(--muted);
}
.customer-search-more { font-style: italic; }

/* ── Variant-табы в карточке товара (фасовка) ── */
.variant-tabs-wrap { margin-bottom: 20px; }
.variant-tabs-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); margin-bottom: 8px;
}
.variant-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.variant-tab {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  font-family: inherit;
  min-width: 110px;
  text-align: left;
}
.variant-tab:hover { border-color: var(--accent); background: var(--accent-bg); }
.variant-tab.active {
  border-color: var(--accent); background: var(--accent-bg);
  box-shadow: 0 0 0 3px rgba(45,165,96,0.15);
}
.variant-tab-label { font-size: 14px; font-weight: 700; color: var(--text); }
.variant-tab-price { font-size: 12px; color: var(--muted); font-weight: 500; }
.variant-tab.active .variant-tab-price { color: var(--accent-2); }

/* ── Loading screen (пока грузится PIM-snapshot) ── */
.store-loading {
  min-height: 50vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  color: var(--muted);
}
.store-loading-spinner {
  font-size: 48px;
  animation: store-loading-pulse 1.4s ease-in-out infinite;
}
.store-loading-text {
  font-size: 14px;
  letter-spacing: 0.3px;
}
@keyframes store-loading-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.1); }
}
