/* ============================================================
   TOKSY — Wallet (кошелёк + обменник + переводы в чате)
   ============================================================ */

/* ============================================================
   ГЛАВНАЯ КАРТОЧКА БАЛАНСА
   ============================================================ */
.wallet-balance-card {
  background: linear-gradient(135deg, #007aff 0%, #5ac8fa 100%);
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  margin: 0 0 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.25);
}
.wallet-balance-card::before {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 170px;
  height: 170px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}
.wallet-balance-card::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -90px;
  width: 210px;
  height: 210px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.wallet-balance-label {
  font-size: 13px;
  opacity: 0.85;
  font-weight: 500;
  margin-bottom: 6px;
  position: relative;
}
.wallet-balance-amount {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  position: relative;
  line-height: 1.15;
}
.wallet-balance-sub {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 8px;
  position: relative;
}

/* ============================================================
   КНОПКИ ДЕЙСТВИЙ
   ============================================================ */
.wallet-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}
.wallet-action-btn {
  background: var(--bg-card, #fff);
  border: 1px solid var(--separator, #e5e5ea);
  border-radius: 14px;
  padding: 14px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary, #000);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.wallet-action-btn:hover { background: var(--bg-sidebar-hover, #f5f5f7); }
.wallet-action-btn:active { transform: scale(0.97); }

.wallet-action-icon {
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}

/* ============================================================
   СПИСОК ВАЛЮТ
   ============================================================ */
.wallet-currencies {
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}
.wallet-currency-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--separator, #f0f0f2);
}
.wallet-currency-row:last-child { border-bottom: none; }
.wallet-currency-row:hover { background: var(--bg-sidebar-hover, #f5f5f7); }

.wallet-currency-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.wallet-currency-icon.BYN  { background: #1a936f; }
.wallet-currency-icon.RUB  { background: #d52b1e; }
.wallet-currency-icon.USD  { background: #2e7d32; }
.wallet-currency-icon.USDT { background: #26a17b; }
.wallet-currency-icon.TON  { background: #0098ea; }
.wallet-currency-icon.TRX  { background: #eb0029; }

.wallet-currency-info { flex: 1; min-width: 0; }
.wallet-currency-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary, #000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wallet-currency-code {
  font-size: 12px;
  color: var(--text-tertiary, #8e8e93);
  margin-top: 2px;
}
.wallet-currency-amount {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  color: var(--text-primary, #000);
}

/* ============================================================
   СПОСОБЫ ОПЛАТЫ
   ============================================================ */
.wallet-methods {
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #fff);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
}
.wallet-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--separator, #f0f0f2);
  transition: background 0.15s;
}
.wallet-method:last-child { border-bottom: none; }
.wallet-method:hover { background: var(--bg-sidebar-hover, #f5f5f7); }

.wallet-method-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-input, #f5f5f7);
  flex-shrink: 0;
}
.wallet-method-info { flex: 1; min-width: 0; }
.wallet-method-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #000);
}
.wallet-method-desc {
  font-size: 12px;
  color: var(--text-tertiary, #8e8e93);
  margin-top: 2px;
}
.wallet-method-arrow {
  color: var(--text-tertiary, #8e8e93);
  font-size: 20px;
}

/* ============================================================
   СУММА ПОПОЛНЕНИЯ
   ============================================================ */
.wallet-amount-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input, #f5f5f7);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.wallet-amount-input input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-primary, #000);
  outline: none;
  text-align: center;
  min-width: 0;
  width: 100%;
}
.wallet-amount-input .currency {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-tertiary, #8e8e93);
}

.wallet-quick-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.wallet-quick-amount {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--separator, #e5e5ea);
  background: var(--bg-card, #fff);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #000);
  cursor: pointer;
  transition: all 0.15s;
}
.wallet-quick-amount:hover { background: var(--bg-sidebar-hover, #f5f5f7); }
.wallet-quick-amount.active {
  background: #007aff;
  color: #fff;
  border-color: #007aff;
}

/* ============================================================
   ИСТОРИЯ
   ============================================================ */
.wallet-history {
  background: var(--bg-card, #fff);
  border-radius: 14px;
  overflow: hidden;
}
.wallet-history-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary, #8e8e93);
  font-size: 13px;
}
.wallet-tx {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--separator, #f0f0f2);
}
.wallet-tx:last-child { border-bottom: none; }

.wallet-tx-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  font-weight: 600;
}
.wallet-tx-icon.in      { background: rgba(52, 199, 89, 0.12);  color: #34c759; }
.wallet-tx-icon.out     { background: rgba(255, 59, 48, 0.12);  color: #ff3b30; }
.wallet-tx-icon.pending { background: rgba(255, 149, 0, 0.12);  color: #ff9500; }

.wallet-tx-info { flex: 1; min-width: 0; }
.wallet-tx-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #000);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wallet-tx-date {
  font-size: 12px;
  color: var(--text-tertiary, #8e8e93);
  margin-top: 2px;
}
.wallet-tx-amount {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.wallet-tx-amount.in      { color: #34c759; }
.wallet-tx-amount.out     { color: #ff3b30; }
.wallet-tx-amount.pending { color: #ff9500; }

/* ============================================================
   ИНФО-БЛОКИ И СТАТУСЫ
   ============================================================ */
.wallet-info-block {
  background: var(--bg-input, #f5f5f7);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-tertiary, #8e8e93);
  line-height: 1.55;
  margin: 12px 0;
}
.wallet-info-block b { color: var(--text-primary, #000); }

.wallet-status-plate {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.wallet-status-plate.pending { background: rgba(255, 149, 0, 0.1); color: #b36a00; }
.wallet-status-plate.success { background: rgba(52, 199, 89, 0.1); color: #1b8c3d; }
.wallet-status-plate.error   { background: rgba(255, 59, 48, 0.1); color: #b3241d; }

/* ============================================================
   АДРЕС / КОПИРОВАНИЕ
   ============================================================ */
.wallet-address-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
}
.wallet-copy-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--separator, #e5e5ea);
  background: var(--bg-card, #fff);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary, #000);
  transition: background 0.15s;
}
.wallet-copy-btn:hover { background: var(--bg-sidebar-hover, #f5f5f7); }

/* ============================================================
   SELECT
   ============================================================ */
.wallet-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--separator, #e5e5ea);
  background: var(--bg-card, #fff);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary, #000);
  cursor: pointer;
}

/* ============================================================
   ОБМЕННИК ВАЛЮТ
   ============================================================ */
.exchange-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.exchange-field { display: flex; flex-direction: column; gap: 6px; }
.exchange-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary, #8e8e93);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-left: 2px;
}

.exchange-select {
  width: 100%;
  padding: 12px 30px 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--separator, #e5e5ea);
  background: var(--bg-card, #fff);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #000);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8e93' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
}
.exchange-select:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.exchange-swap-btn {
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: #007aff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: -6px 0 8px;
}
.exchange-swap-btn:hover { text-decoration: underline; }

.exchange-amount-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input, #f5f5f7);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.exchange-amount-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary, #000);
  outline: none;
  text-align: center;
  min-width: 0;
  width: 100%;
}

.exchange-balance {
  font-size: 12px;
  color: var(--text-tertiary, #8e8e93);
  text-align: right;
  margin-top: -6px;
  margin-bottom: 14px;
  padding-right: 4px;
}
.exchange-balance b {
  color: var(--text-primary, #000);
  font-weight: 600;
}

.exchange-info {
  background: var(--bg-input, #f5f5f7);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13px;
}
.exchange-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  color: var(--text-secondary, #6e6e73);
}
.exchange-info-row:first-child { padding-top: 0; }
.exchange-info-row:last-child { padding-bottom: 0; }

.exchange-info-row.result {
  border-top: 1px solid var(--separator, #e5e5ea);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #000);
}
.exchange-info-row.result span:last-child {
  color: #34c759;
  font-size: 16px;
}

.exchange-error {
  color: #ff3b30;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
  margin-bottom: 8px;
  font-weight: 500;
}

/* ============================================================
   ПЕРЕВОД В ЧАТЕ (карточка сообщения)
   ============================================================ */

/* Прячем баббл, если внутри карточка перевода.
   Без этого фон сообщения (голубой/белый) обрезает карточку по краям. */
.msg-bubble:has(> .msg-crypto-transfer) {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.message:has(.msg-crypto-transfer) {
  max-width: min(340px, 88%);
}
/* Никаких reply-quote внутри переводов — там не нужны */
.msg-bubble:has(> .msg-crypto-transfer) > .msg-reply-quote { display: none; }

/* -------- Базовая карточка -------- */
.msg-crypto-transfer {
  border-radius: 20px;
  padding: 18px 20px 16px;
  color: #fff;
  min-width: min(260px, 76vw);
  max-width: 320px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  /* Дефолт — это «перевод»: насыщенный зелёный */
  background: linear-gradient(135deg, #34c759 0%, #1f8a3f 100%);
}

/* -------- Цветовые состояния -------- */
.msg-crypto-transfer.accepted {
  background: linear-gradient(135deg, #34c759 0%, #1f8a3f 100%);
}
.msg-crypto-transfer.declined {
  background: linear-gradient(135deg, #8b93a1 0%, #5b6472 100%);
  opacity: 0.95;
}
.msg-crypto-transfer.expired {
  background: linear-gradient(135deg, #8b93a1 0%, #5b6472 100%);
  opacity: 0.7;
}

/* Запрос денег — приглушённо-серый, чтобы визуально отличался от перевода */
.msg-crypto-transfer.request {
  background: linear-gradient(135deg, #5b6472 0%, #3a4250 100%);
}

/* -------- Содержимое -------- */
.msg-crypto-transfer-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-crypto-transfer-title svg {
  flex-shrink: 0;
  display: block;
}

.msg-crypto-transfer-amount {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}
.msg-crypto-transfer-amount .currency {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 0;
  margin-left: 4px;
}

.msg-crypto-transfer-fee {
  font-size: 12.5px;
  opacity: 0.75;
  margin-top: 4px;
  margin-bottom: 0;
}

.msg-crypto-transfer-comment {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 13.5px;
  line-height: 1.4;
  font-style: normal;
  opacity: 0.95;
}

/* -------- Кнопки действий -------- */
.msg-crypto-transfer-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.msg-crypto-transfer-btn {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 0.12s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.msg-crypto-transfer-btn:active { transform: scale(0.97); }

.msg-crypto-transfer-btn.accept {
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
}
.msg-crypto-transfer-btn.accept:hover { background: rgba(255, 255, 255, 0.34); }

.msg-crypto-transfer-btn.decline {
  background: rgba(255, 255, 255, 0.14);
}
.msg-crypto-transfer-btn.decline:hover { background: rgba(255, 255, 255, 0.22); }

/* -------- Статус (принято / отклонено / просрочено) -------- */
.msg-crypto-transfer-status {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  min-width: 120px;
}

/* ============================================================
   КНОПКА ₮ В COMPOSER
   ============================================================ */
.icon-btn.pay-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #26a17b;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  background: transparent;
  transition: background 0.15s;
}
.icon-btn.pay-btn:hover { background: rgba(38, 161, 123, 0.1); }
.icon-btn.pay-btn:active { background: rgba(38, 161, 123, 0.2); }

/* ============================================================
   ТЁМНАЯ ТЕМА
   ============================================================ */
html.theme-dark .wallet-currency-icon.BYN,
html.theme-dark .wallet-currency-icon.RUB,
html.theme-dark .wallet-currency-icon.USD,
html.theme-dark .wallet-currency-icon.USDT,
html.theme-dark .wallet-currency-icon.TON,
html.theme-dark .wallet-currency-icon.TRX {
  filter: brightness(0.95);
}

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 640px) {
  .wallet-balance-card { padding: 18px; }
  .wallet-balance-amount { font-size: 26px; }
  .wallet-actions {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .wallet-action-btn {
    padding: 10px 2px;
    font-size: 10px;
  }
  .wallet-action-icon { font-size: 18px; }
  .wallet-amount-input input { font-size: 24px; }
  .wallet-quick-amount { padding: 10px; font-size: 13px; }

  .exchange-row { gap: 8px; }
  .exchange-select { padding: 10px 26px 10px 12px; font-size: 13px; }
  .exchange-amount-wrap input { font-size: 22px; }

  .msg-crypto-transfer {
    min-width: min(240px, 78vw);
    max-width: 300px;
    padding: 16px 18px 14px;
  }
  .msg-crypto-transfer-amount { font-size: 26px; }
  .msg-crypto-transfer-fee    { font-size: 12px; }
  .msg-crypto-transfer-title  { font-size: 11px; letter-spacing: 0.08em; }
  .msg-crypto-transfer-btn    { padding: 10px 12px; font-size: 13px; }
}