/* /opt/dashboard/public/css/app_prices.css */

/* =========================
 * ROOT
 * ========================= */

.prices-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
  min-height: 285px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 10px;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 0 0.5px rgba(255, 255, 255, 0.02) inset;
  width: fit-content;
  max-width: none;
}

/* =========================
 * HEADER
 * ========================= */

.prices-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

/* =========================
 * TOP-RIGHT EDIT (icon only)
 * =========================
 */

.prices-block .icon-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;

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

  z-index: 6;
  user-select: none;

  -webkit-tap-highlight-color: transparent;
}

.prices-block .prices-refresh-btn {
  right: 40px;
}

.prices-block .prices-refresh-btn[disabled] {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

/* =========================
 * BODY
 * ========================= */

.prices-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: none;

  /* ✅ чтобы grid мог растягиваться вниз,
     а тумблеры оставались под ним без "дырки" */
  flex: 1 1 auto;
  min-height: 0;
}

/* =========================
 * HERO
 * ========================= */

.prices-hero {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--bg-elevated);
  padding: 7px 12px;
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.20),
    0 0 0 0.5px rgba(255, 255, 255, 0.03) inset;

  display: flex;
  flex-direction: column;
  gap: 6px;

  /* ✅ hero не растягиваем */
  flex: 0 0 auto;
}

/* legacy (может использоваться где-то ещё) */
.prices-hero-label {
  font-size: 11px;
  opacity: 0.76;
  white-space: nowrap;
  padding-top: 2px;
}

/* =========================
 * HERO RIGHT (metrics layout)
 * ========================= */

.prices-hero-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* metric block */
.prices-hero-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

/* label + value on one line */
.prices-hero-metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

/* ✅ labels left aligned */
.prices-hero-metric-label {
  font-size: 11px;
  opacity: 0.76;
  white-space: nowrap;
  text-align: left;
}

/* values right aligned */
.prices-hero-metric-value {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

/* primary metric bigger (Цена с СПП) */
.prices-hero-metric-value--primary {
  font-size: 22px;
  letter-spacing: -0.01em;
}

.prices-hero-metric-value--editable {
  cursor: pointer;
  transition: color 120ms ease, opacity 120ms ease;
}

.prices-hero-metric-value--editable:hover {
  color: #ffffff;
}

.prices-spp-inline-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(220px, calc(100vw - 48px));
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #2b2b2f;
  box-shadow:
    0 16px 30px rgba(0, 0, 0, 0.42),
    0 0 0 0.5px rgba(255, 255, 255, 0.04) inset;
  padding: 12px;
}

.prices-spp-inline-popover__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.prices-spp-inline-popover__label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(245, 245, 247, 0.92);
}

.prices-spp-inline-popover__input {
  width: 100%;
  height: 46px;
  -moz-appearance: textfield;
  appearance: textfield;
  text-align: left;
}

.prices-spp-inline-popover__input::-webkit-outer-spin-button,
.prices-spp-inline-popover__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.prices-spp-inline-popover__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.prices-spp-inline-popover__actions .btn {
  min-width: 90px;
}

/* ✅ Apple-like divider */
.prices-hero-divider {
  height: 1px;
  width: 100%;
  margin: 0px auto;
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.35) inset;
  border-radius: 1px;
}

/* keep existing classes for compatibility */
.prices-hero-topline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: flex-end;
}

.prices-hero-subline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: flex-end;
}

.prices-hero-value {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ✅ SPP чуть крупнее (legacy) */
.prices-hero-value--spp {
  font-size: 18px;
}

/* ✅ current_price — серым */
.prices-hero-current {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.55);
}

/* metric current slightly calmer */
.prices-hero-current--metric {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.68);
}

/* price_before_discount — НЕ меняем (legacy) */
.prices-hero-base {
  font-size: 12px;
  opacity: 0.55;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

/* metric old/base price: quiet */
.prices-hero-base--metric {
  font-size: 14px;
  opacity: 0.40;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

/* notes under metric */
.prices-hero-note {
  font-size: 11px;
  opacity: 0.62;
  line-height: 0.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* note: right-aligned under values */
.prices-hero-note--metric {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  justify-content: flex-end;
  align-self: flex-end;
}

/* label (СПП:, скидка) */
.prices-note-label {
  opacity: 0.82;
}

/* ✅ percent values: smaller + WHITE */
.prices-note-value {
  opacity: 1;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 650;
}

/* =========================
 * GRID
 * ========================= */

.prices-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--bg-elevated);
  padding: 6px 12px;
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.18),
    0 0 0 0.5px rgba(255, 255, 255, 0.03) inset;

  /* ✅ тёмный блок растягивается вниз,
     воздух появляется ВНУТРИ него снизу */
  flex: 1 1 auto;
  min-height: 0;

  /* чтобы строки всегда оставались наверху */
  align-content: start;
}

.prices-row {
  display: contents;
}

.prices-label {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.72;
  line-height: 1.1;
  white-space: nowrap;
}

.prices-value {
  font-size: 12px;
  font-weight: 750;
  opacity: 0.92;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.prices-divider-row {
  grid-column: 1 / -1;
  height: 1px;
  margin: 3px 0 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.prices-value--club {
  opacity: 0.98;
}

/* =========================
 * BOTTOM: titles + toggles (inline, no separate block)
 * ========================= */

.prices-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-top: 2px;

  /* ✅ тумблеры прижимаем к низу body,
     а grid занимает всё, что сверху */
  flex: 0 0 auto;
}

.prices-bottom-col {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.prices-bottom-title {
  font-size: 11px;
  line-height: 1.1;
  opacity: 0.76;
  white-space: nowrap;
}

/* toggle style copied (visual contract) from .exclude-toggle in app_products.editmode.css
   but WITHOUT body.products-reorder-mode gate */
.prices-toggle {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 0 0 0 42px;
  min-height: 20px;
  font-size: 11px;
  color: rgba(235, 235, 245, 0.88);
  user-select: none;
  cursor: pointer;
  width: max-content;
  max-width: max-content;
  -webkit-tap-highlight-color: transparent;
}

.prices-toggle__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.prices-toggle__text {
  line-height: 1;
  white-space: nowrap;
  color: rgba(235, 235, 245, 0.88);
  position: relative;
  bottom: 2px;
}

/* track */
.prices-toggle::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* knob */
.prices-toggle::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 2px;

  width: 16px;
  height: 16px;
  border-radius: 999px;

  background: rgba(245, 245, 247, 0.92);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);

  transform: translateX(0);
  transition: transform 160ms ease, background 140ms ease;
}

/* ON (checked) */
.prices-toggle.prices-toggle--checked::before {
  background: #30D158;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.prices-toggle.prices-toggle--checked::after {
  transform: translateX(14px);
}

/* focus ring */
.prices-toggle.prices-toggle--focus::before {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 2px rgba(10, 132, 255, 0.35);
}

.prices-toggle.prices-toggle--disabled {
  cursor: default;
  opacity: 0.45;
}

.prices-toggle__hint {
  position: absolute;
  left: 38px;
  bottom: calc(100% - 55px);
  min-width: 148px;
  max-width: 190px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(18, 18, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 30;
  pointer-events: none;
}

.prices-toggle__hint::after {
  content: "";
  position: absolute;
  left: 14px;
  top: calc(100% - 4px);
  width: 8px;
  height: 8px;
  background: rgba(18, 18, 20, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transform: rotate(-45deg);
  z-index: 29;
}

.prices-toggle.prices-toggle--with-hint:hover .prices-toggle__hint,
.prices-toggle.prices-toggle--with-hint:focus-within .prices-toggle__hint {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
 * FIX: RUB sign (₽) on Windows/Chrome
 * ========================= */

.prices-block,
.prices-hero-metric-value,
.prices-hero-current,
.prices-hero-base,
.prices-value {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif;
}
