/**
 * Wallet Modal — стили для модального окна кошелька
 * (подключение, вкладки ввод/вывод, история)
 *
 * Структура как у инвентаря:
 *  - .modal-header (фиксированный заголовок) — в index.html
 *  - #wallet-modal-content — flex-колонка: статичные балансы + прокручиваемая область
 */

#wallet-modal-content {
  display: flex;
  flex-direction: column;
  height: 95vh;
  max-height: 95vh;
  padding: 0 22px 22px;
  padding-top: 20%;
  color: #f4e9c1;
  font-family: 'Cinzel', Georgia, serif;
  overflow: hidden;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#wallet-modal-content::-webkit-scrollbar {
  display: none;
}

/* Статичные ячейки баланса (не прокручиваются) */
.wallet-balances {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* Прокручиваемая область: всё, кроме заголовка и балансов */
.wallet-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 4px;
}

.wallet-scroll-area::-webkit-scrollbar {
  display: none;
}

/* Экран подключения центрируется по вертикали в прокручиваемой области */
.wallet-connect-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wallet-balance {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 8px 16px;
  text-align: center;
  min-width: 100px;
}

.wallet-balance .wb-label {
  font-size: 11px;
  color: #d8cba0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wallet-balance .wb-value {
  font-size: 20px;
  font-weight: 800;
  color: #ffd86b;
}

/* ── Экран подключения кошелька ── */
.wallet-connect-screen {
  text-align: center;
  padding: 20px 10px;
}

.wallet-connect-screen p {
  color: #d8cba0;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.wallet-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #4c9aff, #2a6fc4);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 28px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(76, 154, 255, 0.4);
  transition: transform 0.15s, filter 0.15s;
}

.wallet-connect-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.wallet-connect-btn:active { transform: translateY(0); }

.wallet-connect-btn::before {
  content: '💳';
  font-size: 20px;
}

.wallet-connect-hint {
  margin-top: 14px;
  font-size: 12px;
  color: #8b949e;
}

.wallet-connect-status {
  margin-top: 10px;
  font-size: 13px;
  color: #d8cba0;
  min-height: 18px;
}

.ton-connect-btn-wrap {
  display: flex;
  justify-content: center;
  min-height: 56px;
  align-items: center;
}

/* Стили для встроенной кнопки TON Connect SDK */
.ton-connect-btn-wrap tc-ton-connect-button,
.ton-connect-btn-wrap button {
  display: flex !important;
  justify-content: center !important;
}

.wallet-connected-info {
  margin-top: 14px;
  background: rgba(46, 160, 67, 0.15);
  border: 1px solid rgba(46, 160, 67, 0.5);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
}

.wallet-connected-info .addr {
  font-family: monospace;
  word-break: break-all;
  color: #ffd86b;
  margin-top: 4px;
}

.wallet-connected-info .change-btn {
  margin-top: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,215,0,0.3);
  color: #d8cba0;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
}

/* ── Вкладки ── */
.wallet-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 4px;
}

.wallet-tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: #d8cba0;
  transition: background 0.15s, color 0.15s;
}

.wallet-tab.active {
  background: linear-gradient(180deg, #d9a73a, #8a6a25);
  color: #1a1208;
}

.wallet-tab:not(.active):hover {
  background: rgba(255, 215, 0, 0.12);
  color: #ffd86b;
}

.wallet-tab-panel { display: none; }
.wallet-tab-panel.active { display: block; }

/* ── Подвкладки (Ввод: Покупка / Конвертация) ── */
.wallet-subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 4px;
}

.wallet-subtab {
  flex: 1;
  text-align: center;
  padding: 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #d8cba0;
  transition: background 0.15s, color 0.15s;
}

.wallet-subtab.active {
  background: linear-gradient(180deg, #8a6a25, #5a4516);
  color: #ffd86b;
}

.wallet-subtab:not(.active):hover {
  background: rgba(255, 215, 0, 0.12);
  color: #ffd86b;
}

.wallet-subpanel { display: none; }
.wallet-subpanel.active { display: block; }

/* ── Формы ввода/вывода ── */
.wallet-field {
  margin-bottom: 14px;
}

.wallet-field label {
  display: block;
  font-size: 13px;
  color: #d8cba0;
  margin-bottom: 6px;
}

.wallet-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.4);
  background: rgba(0, 0, 0, 0.45);
  color: #f4e9c1;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  box-sizing: border-box;
}

.wallet-field input:focus {
  outline: none;
  border-color: #ffd86b;
}

.wallet-rate-hint {
  font-size: 12px;
  color: #8b949e;
  text-align: center;
  margin-bottom: 14px;
}

.wallet-summary {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.wallet-summary .ws-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.wallet-summary .ws-row:last-child { margin-bottom: 0; }
.wallet-summary .ws-label { color: #d8cba0; }
.wallet-summary .ws-value { color: #ffd86b; font-weight: 700; }

.wallet-action-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.wallet-action-btn:active { transform: translateY(1px); }
.wallet-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.wallet-action-btn.deposit { background: linear-gradient(180deg, #2ea043, #1a6b2c); color: #fff; }
.wallet-action-btn.withdraw { background: linear-gradient(180deg, #da3633, #8a1f1d); color: #fff; }
.wallet-action-btn.convert { background: linear-gradient(180deg, #d9a73a, #8a6a25); color: #1a1208; }

/* ── Результат операции ── */
.wallet-result {
  background: rgba(46, 160, 67, 0.12);
  border: 1px solid rgba(46, 160, 67, 0.5);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
}

.wallet-result .memo-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(255, 215, 0, 0.5);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  margin: 10px 0;
  font-family: monospace;
  font-size: 22px;
  font-weight: 800;
  color: #ffd86b;
  letter-spacing: 3px;
}

.wallet-result .copy-btn {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,215,0,0.3);
  color: #d8cba0;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 12px;
  display: block;
  margin: 8px auto 0;
}

.wallet-result .addr-line {
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  background: rgba(0,0,0,0.3);
  padding: 6px 8px;
  border-radius: 6px;
  margin: 6px 0;
}

.wallet-error {
  background: rgba(218, 54, 51, 0.15);
  border: 1px solid rgba(218, 54, 51, 0.5);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #ff9b9b;
}

/* ── История ── */
.wallet-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.wallet-hist-item {
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid #8a6a25;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
}

.wallet-hist-item.deposit { border-left-color: #2ea043; }
.wallet-hist-item.withdraw { border-left-color: #4c9aff; }

.wallet-hist-item .wh-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
}

.wallet-hist-item .wh-type { font-weight: 700; color: #ffd86b; }
.wallet-hist-item .wh-status {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 8px;
}
.wallet-hist-item .wh-status.pending { background: #3d2e00; color: #d29922; }
.wallet-hist-item .wh-status.confirmed { background: #0d2818; color: #2ea043; }
.wallet-hist-item .wh-status.rejected { background: #2d0a0a; color: #da3633; }

.wallet-hist-item .wh-detail { color: #d8cba0; font-size: 12px; }
.wallet-hist-item .wh-date { color: #8b949e; font-size: 11px; margin-top: 2px; }

.wallet-empty { text-align: center; color: #8b949e; padding: 24px; font-size: 14px; }

.wallet-loader { text-align: center; color: #d8cba0; padding: 24px; }

/* ── Оверлей заявки на депозит (поверх модалки кошелька) ── */
#wallet-deposit-overlay {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#wallet-deposit-overlay.show {
  opacity: 1;
  visibility: visible;
}

.wallet-deposit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.wallet-deposit-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: linear-gradient(180deg, #2a2438, #181422);
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.65), 0 0 32px rgba(255, 215, 0, 0.18);
  padding: 26px 22px 20px;
  color: #f4e9c1;
  font-family: 'Cinzel', Georgia, serif;
  transform: scale(0.85) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wallet-deposit-card::-webkit-scrollbar { display: none; }

#wallet-deposit-overlay.show .wallet-deposit-card {
  transform: scale(1) translateY(0);
}

/* Заголовок карточки */
.wallet-deposit-header {
  text-align: center;
  margin-bottom: 20px;
}

.wallet-deposit-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2ea043, #1a6b2c);
  box-shadow: 0 0 18px rgba(46, 160, 67, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
}

.wallet-deposit-title {
  font-weight: 800;
  color: #ffd86b;
  font-size: 18px;
  margin-bottom: 6px;
  text-shadow: 0 1px 3px #000;
}

.wallet-deposit-subtitle {
  font-size: 13px;
  color: #d8cba0;
  line-height: 1.5;
}

.wallet-deposit-subtitle b { color: #ffd86b; }

/* Блоки с адресом и MEMO */
.wd-block {
  margin-bottom: 16px;
}

.wd-block-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #a89a6a;
  margin-bottom: 7px;
  font-weight: 700;
}

.wd-addr-line {
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 215, 0, 0.25);
  padding: 10px 12px;
  border-radius: 10px;
  color: #f4e9c1;
  margin-bottom: 8px;
  line-height: 1.4;
}

/* Стилизованные кнопки копирования */
.wd-copy-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 215, 0, 0.35);
  color: #d8cba0;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.wd-copy-btn .wd-copy-icon {
  font-size: 16px;
  color: #ffd86b;
}

.wd-copy-btn:hover {
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.7);
  color: #ffd86b;
}

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

/* Акцентная кнопка копирования MEMO */
.wd-copy-btn-primary {
  background: linear-gradient(180deg, #d9a73a, #8a6a25);
  border-color: rgba(255, 215, 0, 0.8);
  color: #1a1208;
}

.wd-copy-btn-primary .wd-copy-icon { color: #1a1208; }

.wd-copy-btn-primary:hover {
  background: linear-gradient(180deg, #e8b94a, #9a7a35);
  color: #1a1208;
}

/* Блок MEMO */
.wd-memo-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1px dashed rgba(255, 215, 0, 0.6);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  margin-bottom: 8px;
  font-family: monospace;
  font-size: 24px;
  font-weight: 800;
  color: #ffd86b;
  letter-spacing: 4px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Предупреждение о MEMO — привлекает внимание */
.wd-memo-warning {
  background: linear-gradient(180deg, rgba(218, 54, 51, 0.22), rgba(218, 54, 51, 0.12));
  border: 1px solid rgba(255, 140, 120, 0.55);
  border-left: 4px solid #ff6347;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.wd-memo-warning-title {
  color: #ff8a78;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 5px;
  text-shadow: 0 1px 2px #000;
}

.wd-memo-warning-text {
  color: #ffd9d2;
  font-size: 12.5px;
  line-height: 1.5;
}

.wd-memo-warning-text b {
  color: #ff9b8a;
  font-weight: 800;
}

/* Анимация пульсации для предупреждения */
@keyframes wdWarningPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 99, 71, 0.35); }
  50% { box-shadow: 0 0 12px 2px rgba(255, 99, 71, 0.5); }
}

.wd-memo-warning { animation: wdWarningPulse 2s ease-in-out infinite; }

.wallet-deposit-hint {
  margin-top: 4px;
  margin-bottom: 14px;
  color: #a89a6a;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.wallet-deposit-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  color: #d8cba0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  z-index: 2;
}

.wallet-deposit-close:hover {
  color: #ffd86b;
  background: rgba(255, 215, 0, 0.12);
}

/* Тост всегда поверх оверлея депозита */
.wallet-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10020;
  max-width: 90vw;
  text-align: center;
}
