/* ==========================================================================
   style.css — global tokens + shared components
   ========================================================================== */

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

:focus-visible {
  outline: none;
}

:root {
  color-scheme: dark;

  /* macOS-like dark palette */
  --bg-main: #000000;
  --bg-elevated: #1c1c1e;
  --bg-panel: #2c2c2e;
  --bg-sector: #3a3a3c;
  --text-main: rgba(245, 245, 247, 0.95);
  --text-muted: rgba(161, 161, 170, 0.85);
  --border-soft: rgba(255, 255, 255, 0.10);
  --border-radius: 14px;
  --accent: #0a84ff;
  --success: #22c55e;
  --danger: #f6292b;
  --warning: #f59e0b;

  /* sticky + horizontal scroll tuning (используется в app.css / products) */
  --sticky-gap: 12px;

  /* ширины правых колонок */
  --col-orders-w: 380px;

  /* ===== shared select tokens ===== */
  --select-h: 34px;
  --select-fs: 13px;
  --select-r: 6px;
  --caret-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='rgba(245,245,247,0.85)' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --caret-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath d='M7 14l5-5 5 5' fill='none' stroke='rgba(245,245,247,0.85)' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  --select-caret: var(--caret-down);

  /* ===== buttons (optional shared) ===== */
  --btn-radius: 6px;
  --btn-font-size: 12px;
  --btn-font-weight: 400;
  --btn-letter-spacing: 0.01em;
  --btn-bg: rgba(255, 255, 255, 0.08);
  --btn-bg-hover: rgba(255, 255, 255, 0.16);

  --btn-text: rgba(235, 235, 245, 0.8);
  --btn-text-hover: rgba(245, 245, 247, 0.95);

  --btn-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 4px 4px rgba(0, 0, 0, 0.35);

  --btn-shadow-active:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 3px 8px rgba(0, 0, 0, 0.35);

  --btn-focus-ring: 0 0 0 2px rgba(10, 132, 255, 0.35);

  --btn-primary-bg: rgba(10, 132, 255, 1.0);
  --btn-primary-bg-hover: rgb(50, 153, 255);
  --btn-primary-bg-active: rgb(88, 163, 237);
  --btn-primary-text: rgba(245, 245, 247, 1);

  /* ===== shared icon buttons ===== */
  --iconbtn-size: 26px;
  --iconbtn-radius: 10px;
  --iconbtn-bg-hover: rgba(255, 255, 255, 0.06);
  --iconbtn-fg: rgba(161, 161, 170, 0.90);
  --iconbtn-fg-hover: rgba(245, 245, 247, 0.92);
  --iconbtn-focus-ring: 0 0 0 2px rgba(10, 132, 255, 0.35);

  --main-scrollbar-thumb: rgba(255, 255, 255, 0.14);
  --main-scrollbar-thumb-hover: rgba(255, 255, 255, 0.20);
  --main-scrollbar-track: rgba(255, 255, 255, 0.04);
  --main-scrollbar-size: 8px;
}

/* ==========================================================================
   Shared buttons (если где-то используешь .btn)
   ========================================================================== */

.btn {
  padding: 6px 14px;
  border: 0;
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow);
  border-radius: var(--btn-radius);
  font-size: var(--btn-font-size);
  font-weight: var(--btn-font-weight);
  letter-spacing: var(--btn-letter-spacing);
  color: var(--btn-text);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 80ms ease, box-shadow 120ms ease;
}

.btn:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-text-hover);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: var(--btn-shadow-active);
}

.btn:focus-visible {
  box-shadow: var(--btn-focus-ring);
}

.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  box-shadow: var(--btn-shadow);
  transition: background 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.btn--primary:hover {
  background: var(--btn-primary-bg-hover);
}

.btn--primary:active {
  transform: translateY(2px);
  background: var(--btn-primary-bg-active);
  box-shadow: var(--btn-shadow-active);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
  background: transparent;
  box-shadow: none;
  transform: none !important;
}

/* ==========================================================================
   Shared icon buttons
   ========================================================================== */

.iconbtn {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  color: var(--iconbtn-fg);
  cursor: pointer;

  width: var(--iconbtn-size);
  height: var(--iconbtn-size);
  border-radius: var(--iconbtn-radius);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  line-height: 1;
  user-select: none;

  transition:
    background 140ms ease,
    color 140ms ease,
    transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 160ms ease;
}

.iconbtn:hover {
  background: var(--iconbtn-bg-hover);
  color: var(--iconbtn-fg-hover);
}

.iconbtn:active {
  transform: translateY(1px);
}

.iconbtn:focus-visible {
  box-shadow: var(--iconbtn-focus-ring);
}

/* variant: close (✕) */
.iconbtn--close {
  --iconbtn-size: 26px;
  --iconbtn-radius: var(--select-r, 10px);
  font-size: 18px;
}

/* ==========================================================================
   Base checkbox style (shared)
   ========================================================================== */

/* shared checkbox: remove native grey flash */
.ui-checkbox,
.glue-pick__cb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  /* важно: убираем "серую" анимацию нативного UI */
  transition: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-checkbox:hover,
.glue-pick__cb:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
}

.ui-checkbox:focus-visible,
.glue-pick__cb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.35);
}

/* checked: сразу синий фон + белая галочка */
.ui-checkbox:checked,
.glue-pick__cb:checked {
  background: var(--accent);
}

/* галочка через псевдоэлемент */
.ui-checkbox:checked::after,
.glue-pick__cb:checked::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 1px solid rgba(245, 245, 247, 1);
  border-bottom: 1px solid rgba(245, 245, 247, 1);
  transform: rotate(-45deg);
  margin-top: -1px;
}

/* ==========================================================================
   Toast (moved from app.js inline styles)
   ========================================================================== */

#app-toast {
  position: fixed;
  left: 50%;
  top: 45px;
  transform: translateX(-50%);
  z-index: 9999;
  pointer-events: none;
  display: flex;
  justify-content: center;
  width: min(720px, calc(100vw - 24px));
  padding-top: env(safe-area-inset-top, 0px);
}

.toast {
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.2px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Inter, system-ui, sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-elevated);
  color: rgba(245, 245, 247, 0.95);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 0 0.5px rgba(255, 255, 255, 0.02) inset;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  transition: opacity 180ms ease, transform 220ms ease;
}

.toast--closable {
  pointer-events: auto;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast--error {
  border: 1px solid rgba(255, 69, 58, 0.28);
  background: rgba(40, 10, 10, 0.56);
}

.toast--success {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--bg-elevated);
}

.toast--warning {
  border: 1px solid rgba(255, 179, 64, 0.28);
  background: rgba(59, 38, 10, 0.56);
}

.toast__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast__text {
  min-width: 0;
}

.toast__spinner {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(245, 245, 247, 0.92);
  animation: toastSpin 0.8s linear infinite;
  transform: translateZ(0);
  will-change: transform;
}

.toast__close {
  pointer-events: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  border-radius: 999px;
  opacity: 0.82;
  cursor: pointer;
}

.toast__close[hidden] {
  display: none;
}

.toast__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.toast__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.42);
  outline-offset: 2px;
}

@keyframes toastSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* NEW badge (anchored to the photo AREA wrapper, can "stick out" outside photo box) */
.product-image-wrap {
  position: relative;
}

/* optional fallback text inside image box */
.product-image-fallback {
  font-size: 12px;
  text-align: center;
  padding: 3px;
  color: #fff;
}

.product-badge-new {
  position: absolute;
  left: 60px;
  top: -5px;
  z-index: 20;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.98), rgba(22, 163, 74, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset;

  user-select: none;
  pointer-events: none;
}

/* “скрученные/сколотые” уголки */
.product-badge-new::before,
.product-badge-new::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0.75;
}

.product-badge-new::before {
  left: -1px;
  top: -1px;
  background: rgba(0, 0, 0, 0.18);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.product-badge-new::after {
  right: -1px;
  bottom: -1px;
  background: rgba(255, 255, 255, 0.20);
  clip-path: polygon(100% 100%, 0 100%, 100% 0);
}

.product-card-trash-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 48px;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  cursor: pointer;
  z-index: 6;
  border-radius: 10px;
  transition: background-color 140ms ease, transform 140ms ease;
}

/* иконка — красная */
.product-card-trash-btn svg {
  display: block;
  color: #e53935;
  pointer-events: none;
  transition: color 140ms ease, transform 140ms ease;
}

/* подпись — нейтральная */
.product-card-trash-btn::after {
  content: "В архив";
  margin-top: 4px;
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
  color: #E0E0E0;
  opacity: 0.9;

  white-space: nowrap;
  pointer-events: none;
  transition: color 140ms ease, opacity 140ms ease;
}

.product-card-trash-btn:hover,
.product-card-trash-btn:active,
.product-card-trash-btn:focus,
.product-card-trash-btn:focus-visible {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
}

.product-card-trash-btn:hover,
.product-card-trash-btn:focus-visible {
  background: rgba(255, 69, 58, 0.12) !important;
}

.product-card-trash-btn:hover svg,
.product-card-trash-btn:focus-visible svg {
  color: #ff453a;
  transform: scale(1.03);
}

.product-card-trash-btn:hover::after,
.product-card-trash-btn:focus-visible::after {
  color: #ffb4ad;
  opacity: 1;
}

/* common edit icon button */
.icon-edit-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  margin: -2px 0;
  border-radius: 8px;
  opacity: 0.75;
  flex: 0 0 auto;
  transition: opacity 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.icon-edit-btn svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.92;
}

.icon-edit-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-0.5px);
}

.icon-edit-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-edit-btn[aria-disabled="true"]:hover,
.icon-edit-btn[aria-disabled="true"]:active,
.icon-edit-btn[aria-disabled="true"]:focus-visible {
  opacity: 0.45;
  background: transparent;
  transform: none;
  color: inherit;
}

.icon-edit-btn:active {
  transform: translateY(0);
}

.icon-edit-btn.js-product-activity-delete:hover,
.icon-edit-btn.js-product-activity-delete:focus-visible,
.icon-edit-btn.js-product-header-archive:hover,
.icon-edit-btn.js-product-header-archive:focus-visible,
.icon-edit-btn.sidebar-price-slot-remove:hover,
.icon-edit-btn.sidebar-price-slot-remove:focus-visible,
.icon-edit-btn[data-action="seller-warehouse-remove"]:hover,
.icon-edit-btn[data-action="seller-warehouse-remove"]:focus-visible {
  color: #ff453a;
  background: rgba(255, 69, 58, 0.14);
  opacity: 1;
}

/* =========================
 * Confirm modal (reusable)
 * ========================= */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  /* выше карточек/поповеров */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.56);
}

.confirm-modal {
  width: min(380px, calc(100vw - 36px)) !important;
  border-radius: 14px;
  background: rgba(24, 24, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  color: rgba(245, 245, 247, 0.95);
  overflow: hidden;
}

.confirm-header {
  padding: 14px 16px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.confirm-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  margin: 0;
}

.confirm-body {
  padding: 12px 16px 14px 16px;
}

.confirm-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0;
}

.confirm-text strong {
  color: var(--text-main);
  font-weight: 600;
}

.confirm-modal .btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.confirm-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.confirm-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 245, 247, 0.92);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.confirm-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

.confirm-btn:active {
  transform: translateY(1px);
}

.confirm-btn:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.confirm-btn--ghost {
  background: transparent;
}

.confirm-btn--primary {
  background: rgba(0, 122, 255, 0.18);
  border-color: rgba(0, 122, 255, 0.30);
}

.confirm-btn--primary:hover {
  background: rgba(0, 122, 255, 0.24);
  border-color: rgba(0, 122, 255, 0.38);
}

.confirm-btn--danger {
  background: rgba(255, 69, 58, 0.18);
  border-color: rgba(255, 69, 58, 0.30);
}

.confirm-btn--danger:hover {
  background: rgba(255, 69, 58, 0.24);
  border-color: rgba(255, 69, 58, 0.38);
}

.confirm-modal--danger .confirm-title {
  color: rgba(255, 186, 181, 0.98);
}

/* Optional: subtle “pop” animation */
@media (prefers-reduced-motion: no-preference) {
  .confirm-modal {
    transform: translateY(4px);
    opacity: 0;
    animation: confirm-in 140ms ease forwards;
  }

  @keyframes confirm-in {
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

.ui-icon-info {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -4px;
  margin-right: 5px;
  margin-left: 0px;
  opacity: 0.85;

  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'>\
<circle cx='12' cy='12' r='10' stroke='%23b5b5b5' stroke-width='2'/>\
<line x1='12' y1='10' x2='12' y2='16' stroke='%23b5b5b5' stroke-width='2' stroke-linecap='round'/>\
<circle cx='12' cy='7' r='1.5' fill='%23b5b5b5'/>\
</svg>");
}

.ui-icon-info:hover {
  opacity: 1;
}

/* ==========================================================================
   Shared numeric stepper
   ========================================================================== */

.numeric-stepper {
  position: relative;
  width: 100%;
}

.numeric-stepper > .numeric-stepper__input {
  padding: 0 18px 0 8px;
}

.numeric-stepper__input::-webkit-outer-spin-button,
.numeric-stepper__input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.numeric-stepper__input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.numeric-stepper__buttons {
  position: absolute;
  top: 3px;
  right: 3px;
  bottom: 3px;

  width: 16px;

  display: grid;
  grid-template-rows: 1fr 1fr;

  overflow: hidden;
  border-radius: 5px;
  border-left: 1px solid rgba(255, 255, 255, 0.10);
}

.numeric-stepper__btn {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255, 255, 255, 0.06);
  color: rgba(235, 235, 245, 0.78);

  font-size: 8px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.numeric-stepper__btn + .numeric-stepper__btn {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.numeric-stepper__btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(245, 245, 247, 0.96);
}

.numeric-stepper__btn:active {
  background: rgba(255, 255, 255, 0.14);
}

.numeric-stepper__btn:focus-visible {
  outline: 2px solid rgba(10, 132, 255, 0.45);
  outline-offset: -2px;
}

