﻿/* ══════════════════════════════════════════════
   MARKET — стили
══════════════════════════════════════════════ */

.mkt-wrap {
  width: 100%;
  max-width: 1280px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mkt-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.mkt-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
}

.mkt-subtitle {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* ── Тулбар ── */
.mkt-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 12px;
  padding: 12px 14px;
}

.mkt-search {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0e0e0e;
  border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 9px;
  padding: 0 14px;
  height: 40px;
  color: var(--text-faint);
  transition: border-color 0.15s;
}

.mkt-search:focus-within { border-color: rgba(var(--accent-rgb),0.33); color: var(--accent); }

.mkt-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  height: 100%;
}

/* ── Поля цены ── */
.mkt-price-field {
  display: flex; align-items: center; gap: 6px;
  background: #0d1526; border: 1px solid rgba(var(--accent-rgb),0.2);
  border-radius: 9px; padding: 0 12px; height: 40px;
  transition: border-color .15s;
}
.mkt-price-field:focus-within { border-color: var(--accent); }
.mkt-price-lbl {
  font-size: 10px; font-weight: 700; color: var(--text-mute);
  flex-shrink: 0; user-select: none;
}
.mkt-price-field input {
  width: 58px; background: none; border: none; outline: none;
  color: var(--text); font-size: 12px; font-weight: 600;
  -moz-appearance: textfield;
}
.mkt-price-field input::-webkit-outer-spin-button,
.mkt-price-field input::-webkit-inner-spin-button { -webkit-appearance: none; }
.mkt-price-field input::placeholder { color: #2a3441; }

/* ── Кнопка сортировки ── */
.mkt-sort-btn {
  background: #0d1526; border: 1px solid rgba(var(--accent-rgb),0.2);
  border-radius: 9px; padding: 0 14px; height: 40px;
  color: var(--text-dim); font-size: 12px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: border-color .15s, color .15s; flex-shrink: 0;
  white-space: nowrap; outline: none;
}
.mkt-sort-btn:hover { border-color: var(--accent); color: var(--text); }
.mkt-sort-arrow { color: #4ad4f0; font-size: 14px; line-height: 1; }

.mkt-affordable-btn.active {
  border-color: #4ad476;
  color: #4ad476;
  background: rgba(74,212,118,.1);
  box-shadow: 0 0 10px rgba(74,212,118,.18);
}

.mkt-inv-btn {
  background: #0d1526; border: 1px solid rgba(74,212,240,0.25);
  border-radius: 9px; padding: 0 14px; height: 40px;
  color: #4ad4f0; font-size: 12px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: border-color .15s, color .15s, background .15s; flex-shrink: 0;
  white-space: nowrap; text-decoration: none; outline: none;
}
.mkt-inv-btn:hover { border-color: #4ad4f0; background: rgba(74,212,240,0.08); color: #7ae0f5; }

/* ── Сетка ── */
.mkt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.mkt-loading,
.mkt-empty {
  grid-column: 1 / -1;
  color: var(--text-faint);
  font-size: 14px;
  padding: 60px 0;
  text-align: center;
}

.mkt-empty-icon {
  font-size: 38px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════
   BULK ACTION BAR
══════════════════════════════════════════════════════════════ */
.mkt-bulkbar {
  position: sticky; top: 8px; z-index: 5;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(var(--accent-rgb), 0.12), transparent 60%),
    var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.35);
}


.mkt-bulk-info {
  font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums;
}
.mkt-bulk-info span:first-child { font-weight: 800; color: var(--accent); }
.mkt-bulk-info span:last-child  { font-weight: 800; color: #4ad476; }

.mkt-bulk-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.5px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.mkt-bulk-btn--buy {
  margin-left: auto;
  background: linear-gradient(135deg, #4ad476, #2faf57);
  color: #06200f;
  box-shadow: 0 4px 14px rgba(74, 212, 118, 0.3);
}
.mkt-bulk-btn--buy:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(74, 212, 118, 0.45);
}
.mkt-bulk-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Карточка ── */
.mkt-card {
  position: relative;
  background: linear-gradient(180deg, #131a28 0%, #0f1521 100%);
  border: 1px solid rgba(var(--accent-rgb),0.12);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mkt-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--rc, #1a9fff);
  opacity: 0.85;
  z-index: 2;
}

.mkt-card:hover {
  transform: translateY(-3px);
  border-color: var(--rc, rgba(var(--accent-rgb),0.2));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.mkt-card-art {
  position: relative;
  height: 148px;
  background: rgba(8, 13, 24, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
}

.mkt-card-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, var(--rc, #1a9fff) 0%, transparent 70%);
  opacity: 0.12;
  pointer-events: none;
}

.mkt-card-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}

.mkt-card:hover .mkt-card-img { transform: scale(1.08); }

.mkt-card-icon {
  font-size: 40px;
  opacity: 0.5;
  position: relative;
  z-index: 1;
}

.mkt-card-info {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.mkt-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mkt-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mkt-card-wear {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

.mkt-card-rarity {
  font-size: 10px;
  font-weight: 600;
  color: var(--rc, #7ab8e0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mkt-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}

.mkt-card-price {
  font-size: 16px;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.mkt-card-buy {
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb),0.2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all 0.15s;
}

.mkt-card-buy:hover {
  background: linear-gradient(135deg, #4ad476, #2eaa58);
  border-color: #4ad476;
  color: var(--bg);
}

.mkt-card-buy:disabled {
  opacity: 0.4;
  cursor: default;
  background: var(--bg-card);
  border-color: rgba(var(--accent-rgb),0.2);
  color: var(--text-faint);
}


/* ── Модалка покупки ── */
.mkt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: mktFade 0.2s ease;
}

.mkt-modal-overlay.open { display: flex; }

.mkt-modal {
  position: relative;
  background: linear-gradient(180deg, #131a28 0%, #0d1320 100%);
  border: 1px solid rgba(var(--accent-rgb),0.2);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 28px 26px 24px;
  animation: mktPop 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.mkt-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb),0.2);
  color: var(--text-faint);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.mkt-modal-close:hover { color: var(--text); border-color: var(--text-mute); }

.mkt-modal-art {
  position: relative;
  height: 160px;
  background: rgba(8, 13, 24, 0.5);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.mkt-modal-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, var(--rc, #1a9fff) 0%, transparent 70%);
  opacity: 0.18;
  pointer-events: none;
}

.mkt-modal-art img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6));
  position: relative;
  z-index: 1;
}

.mkt-modal-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.mkt-modal-rarity {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.mkt-modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid rgba(var(--accent-rgb),0.12);
  font-size: 13px;
}

.mkt-modal-row-label { color: var(--text-faint); }

.mkt-modal-row-value {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mkt-modal-row-value.price { color: var(--accent); font-size: 16px; }
.mkt-modal-row-value.balance-after { color: #4ad476; }
.mkt-modal-row-value.balance-after.negative { color: #d4634a; }

.mkt-modal-confirm {
  width: 100%;
  height: 46px;
  margin-top: 16px;
  background: linear-gradient(135deg, #4ad476, #2eaa58);
  color: var(--bg);
  border: none;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.mkt-modal-confirm:hover:not(:disabled) { opacity: 0.9; }

.mkt-modal-confirm:disabled {
  background: var(--bg-card);
  color: var(--text-mute);
  cursor: not-allowed;
}

/* ── Toast ── */
.mkt-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid rgba(var(--accent-rgb),0.2);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.mkt-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mkt-toast.ok    { border-color: #4ad47655; }
.mkt-toast.error { border-color: #d4634a55; }

@keyframes mktFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mktPop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}

@keyframes spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════════════
   КАРТОЧКА: ВЫДЕЛЕНИЕ + ЧЕКБОКС
══════════════════════════════════════════════════════════════ */
.mkt-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.4), 0 6px 20px rgba(var(--accent-rgb), 0.18);
  transform: translateY(-3px);
}

.mkt-card-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
  opacity: 0;
  pointer-events: none;
}
.mkt-card:hover .mkt-card-check,
.mkt-card.selected .mkt-card-check { opacity: 1; }
.mkt-card.selected .mkt-card-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.mkt-card.unaffordable {
  opacity: 0.35;
  cursor: not-allowed;
}
.mkt-card.unaffordable:hover {
  transform: none;
  border-color: rgba(var(--accent-rgb), 0.12);
  box-shadow: none;
}
.mkt-card.unaffordable .mkt-card-check { display: none; }

/* ── StatTrak ── */
.mkt-card-st {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  padding: 3px 7px;
  border-radius: 6px;
  background: linear-gradient(135deg, #cf6a32 0%, #f08a3e 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  box-shadow: 0 2px 8px rgba(207, 106, 50, 0.45);
  pointer-events: none;
}

.mkt-st-prefix {
  color: #f08a3e;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.mkt-card.is-stattrak {
  border-color: rgba(240, 138, 62, 0.35);
}
.mkt-card.is-stattrak:hover {
  border-color: rgba(240, 138, 62, 0.65);
}
