/* ═══════════════════════════════════════════════
   VOID MINI APP — STYLES
   styles.css
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,900&display=swap');

/* ──────────────────────────────────────────────
   RESET
────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none;
}
*::-webkit-scrollbar { display: none; }

/* ──────────────────────────────────────────────
   CSS VARIABLES (default: dark)
   Переопределяются из theme.js через style на :root
────────────────────────────────────────────── */
:root {
  --bg:        #17212B;
  --surface:   #1E2936;
  --surface2:  #242F3D;
  --border:    #2A3847;
  --accent:    #2AABEE;
  --accent2:   #1D8CC8;
  --text:      #FFFFFF;
  --subtext:   #6D8296;
  --green:     #4CD964;
  --red:       #FF3B30;
  --fade-rgb:  23,33,43;
}

/* ──────────────────────────────────────────────
   BASE
────────────────────────────────────────────── */
html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ──────────────────────────────────────────────
   BLUR FADES (top + bottom)
────────────────────────────────────────────── */
.top-fade {
  position: fixed; top: 0; left: 0; right: 0;
  height: 120px;
  z-index: 10; pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(var(--fade-rgb), 1)    0%,
    rgba(var(--fade-rgb), 0.85) 35%,
    rgba(var(--fade-rgb), 0.4)  65%,
    rgba(var(--fade-rgb), 0)    100%
  );
  transition: background 0.3s ease;
}
.top-fade::after {
  content: '';
  position: absolute; inset: 0;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom,
    rgba(0,0,0,1) 0%, rgba(0,0,0,0.9) 20%,
    rgba(0,0,0,0.5) 55%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom,
    rgba(0,0,0,1) 0%, rgba(0,0,0,0.9) 20%,
    rgba(0,0,0,0.5) 55%, rgba(0,0,0,0) 100%);
}

.bottom-fade {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 130px;
  z-index: 10; pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(var(--fade-rgb), 1)    0%,
    rgba(var(--fade-rgb), 0.85) 35%,
    rgba(var(--fade-rgb), 0.4)  65%,
    rgba(var(--fade-rgb), 0)    100%
  );
  transition: background 0.3s ease;
}
.bottom-fade::after {
  content: '';
  position: absolute; inset: 0;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to top,
    rgba(0,0,0,1) 0%, rgba(0,0,0,0.9) 20%,
    rgba(0,0,0,0.5) 55%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to top,
    rgba(0,0,0,1) 0%, rgba(0,0,0,0.9) 20%,
    rgba(0,0,0,0.5) 55%, rgba(0,0,0,0) 100%);
}

/* ──────────────────────────────────────────────
   APP SCROLL CONTAINER
────────────────────────────────────────────── */
.app {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 80px;
  transition: background 0.3s ease, opacity 0.5s ease;
  /* Скрыт до завершения загрузки */
  opacity: 0;
  pointer-events: none;
}
.app.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ──────────────────────────────────────────────
   AVATAR
────────────────────────────────────────────── */
.avatar-wrap {
  margin-top: 90px;
  display: flex; justify-content: center;
  animation: fadeIn 0.6s ease both;
}

.avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #1A6FA8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--border);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

/* ──────────────────────────────────────────────
   USER INFO
────────────────────────────────────────────── */
.user-block {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  margin-top: 20px;
  width: 100%;
  animation: fadeIn 0.5s 0.1s ease both;
}

.user-name {
  font-size: 34px; font-weight: 800;
  color: var(--text); text-align: center;
  line-height: 1;
  letter-spacing: 0.5px;
}

.user-tag {
  font-size: 16px; font-weight: 600;
  color: var(--subtext); text-align: center; line-height: 1;
  letter-spacing: 0.3px;
}

/* ──────────────────────────────────────────────
   BALANCE
────────────────────────────────────────────── */
.balance-block {
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
  margin-top: 80px;
  animation: fadeIn 0.5s 0.2s ease both;
}

.balance-label {
  font-size: 13px; font-weight: 700;
  color: var(--subtext); text-align: center; line-height: 1;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.balance-amount {
  font-size: 92px; font-weight: 900; font-style: italic;
  color: var(--text); text-align: center;
  line-height: 1;
  letter-spacing: -1.5px;
}

/* ──────────────────────────────────────────────
   TOPUP BUTTON
────────────────────────────────────────────── */
.topup-wrap {
  width: 90%; max-width: 400px;
  display: flex; justify-content: center;
  margin-top: 90px;
  animation: fadeIn 0.5s 0.2s ease both;
}

.btn-topup {
  width: 100%; height: 60px;
  background: var(--accent);
  border: none; border-radius: 42px;
  display: flex; align-items: center; justify-content: center;
  gap: 0;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-topup:active {
  background: var(--accent2);
  transform: scale(0.97);
}

.btn-topup-icon {
  width: 24px; height: 24px; flex-shrink: 0;
}

.btn-topup-text {
  font-size: 17px; font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px; line-height: 1;
}

/* ──────────────────────────────────────────────
   TRANSACTIONS LIST
────────────────────────────────────────────── */
.tx-wrap {
  width: 90%; max-width: 400px;
  display: flex; flex-direction: column;
  gap: 2px;
  margin-top: 36px;
  padding: 0 0 40px;
}

.tx-section-label {
  font-size: 13px; font-weight: 700;
  color: var(--subtext);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 6px 10px;
  margin-top: 4px;
}

.tx-tile {
  width: 100%; height: 72px;
  background: var(--surface);
  display: flex; align-items: center;
  gap: 14px;
  padding: 0 18px;
  cursor: default;
  transition: background 0.12s, opacity 0.3s ease;
  flex-shrink: 0;
  opacity: 0;
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.tx-tile:active { background: var(--surface2); }

.tx-tile.first { border-radius: 45px 45px 10px 10px; }
.tx-tile.mid   { border-radius: 10px; }
.tx-tile.last  { border-radius: 10px 10px 45px 45px; }
.tx-tile.solo  { border-radius: 45px; }

/* Staggered animation delays для до 15 транзакций */
.tx-tile:nth-child(1)  { animation-delay: 0.08s; }
.tx-tile:nth-child(2)  { animation-delay: 0.13s; }
.tx-tile:nth-child(3)  { animation-delay: 0.18s; }
.tx-tile:nth-child(4)  { animation-delay: 0.23s; }
.tx-tile:nth-child(5)  { animation-delay: 0.28s; }
.tx-tile:nth-child(6)  { animation-delay: 0.33s; }
.tx-tile:nth-child(7)  { animation-delay: 0.38s; }
.tx-tile:nth-child(8)  { animation-delay: 0.43s; }
.tx-tile:nth-child(9)  { animation-delay: 0.48s; }
.tx-tile:nth-child(10) { animation-delay: 0.53s; }
.tx-tile:nth-child(11) { animation-delay: 0.58s; }
.tx-tile:nth-child(12) { animation-delay: 0.63s; }
.tx-tile:nth-child(13) { animation-delay: 0.68s; }
.tx-tile:nth-child(14) { animation-delay: 0.73s; }
.tx-tile:nth-child(15) { animation-delay: 0.78s; }

.tx-icon-wrap {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.tx-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
}

.tx-name {
  font-size: 16px; font-weight: 700;
  color: var(--text); line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.tx-time {
  font-size: 12px; font-weight: 500;
  color: var(--subtext); line-height: 1;
}

.tx-amount {
  font-size: 16px; font-weight: 700;
  color: var(--text); text-align: right;
  flex-shrink: 0; white-space: nowrap;
}

.tx-amount.green { color: var(--green); }
.tx-name.green   { color: var(--green); }

/* ──────────────────────────────────────────────
   OVERLAY + BOTTOM SHEET
────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 50; opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay.open { opacity: 1; pointer-events: all; }

.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 42px 42px 0 0;
  padding: 0 0 50px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  touch-action: none;
  user-select: none;
  border-top: 1px solid var(--border);
}
.overlay.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 14px auto 22px;
}

.sheet-title {
  font-size: 20px; font-weight: 800;
  letter-spacing: 0.2px;
  text-align: center; padding: 0 20px 22px;
  color: var(--text);
}

.preset-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; padding: 0 16px 14px;
}

.preset-btn {
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 42px;
  padding: 15px 0;
  font-family: 'Inter', sans-serif;
  font-size: 17px; font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease; text-align: center;
}
.preset-btn:active { transform: scale(0.95); background: var(--border); }
.preset-btn.sel    { background: var(--accent); border-color: var(--accent); }

.custom-wrap { padding: 0 16px 20px; }

.custom-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 42px;
  padding: 16px 18px;
  font-family: 'Inter', sans-serif;
  font-size: 17px; font-weight: 600;
  color: var(--text);
  text-align: center; outline: none;
  transition: border-color 0.2s ease;
}
.custom-input:focus  { border-color: var(--accent); }
.custom-input.error  { border-color: var(--red); }
.custom-input.error:focus { border-color: var(--red); }
.custom-input::placeholder { color: var(--subtext); font-weight: 500; }
.custom-input::-webkit-outer-spin-button,
.custom-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.custom-input[type=number] { -moz-appearance: textfield; }

.input-error-msg {
  text-align: center;
  font-size: 13px; font-weight: 600;
  color: var(--red);
  height: 18px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.input-error-msg.visible { opacity: 1; }

.sheet-confirm {
  width: calc(100% - 32px); margin: 0 16px; height: 56px;
  background: var(--accent); border: none; border-radius: 42px;
  font-family: 'Inter', sans-serif;
  font-size: 17px; font-weight: 700; color: #fff;
  cursor: pointer; transition: all 0.18s;
}
.sheet-confirm:active   { background: var(--accent2); transform: scale(0.97); }
.sheet-confirm:disabled {
  background: var(--surface2);
  color: var(--subtext);
  cursor: not-allowed;
  transform: none;
}

/* ──────────────────────────────────────────────
   ANIMATIONS
────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────
   EMPTY STATE
────────────────────────────────────────────── */
.tx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 24px 32px;
  animation: fadeIn 0.5s 0.1s ease both;
  opacity: 0;
}

.tx-empty-icon {
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--subtext);
  margin-bottom: 4px;
}

.tx-empty-title {
  font-size: 17px; font-weight: 700;
  color: var(--text);
  letter-spacing: 0.1px;
}

.tx-empty-desc {
  font-size: 14px; font-weight: 500;
  color: var(--subtext);
  text-align: center;
  line-height: 1.4;
  max-width: 220px;
}

/* ──────────────────────────────────────────────
   LOADING SCREEN
────────────────────────────────────────────── */
.loading-screen {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
.loading-screen.fade-out { opacity: 0; pointer-events: none; }
.loading-screen.hidden   { display: none; }

.loading-content {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px;
}

.loading-err-title {
  font-size: 17px; font-weight: 700;
  color: var(--text); text-align: center;
}

.loading-err-desc {
  font-size: 14px; font-weight: 500;
  color: var(--subtext); text-align: center;
  max-width: 220px; line-height: 1.4;
}

.loading-ring {
  width: 60px; height: 60px;
  transform: rotate(-90deg);
}

.loading-ring-track {
  fill: none;
  stroke: var(--surface2);
  stroke-width: 4;
}

.loading-ring-arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 150.796;   /* 2π × 24 */
  stroke-dashoffset: 113.097;  /* 75% скрыто — видно ~25% дуги */
  animation: spin-arc 1s linear infinite;
  transform-origin: center;
}

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

.loading-msg {
  font-size: 15px; font-weight: 600;
  color: var(--subtext);
  letter-spacing: 0.3px;
  animation: loading-pulse 1.6s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1;   }
}



.loading-err-title {
  font-size: 17px; font-weight: 700;
  color: var(--text); text-align: center;
}

.loading-err-desc {
  font-size: 14px; font-weight: 500;
  color: var(--subtext); text-align: center;
}

[data-theme="light"] .overlay {
  background: rgba(0,0,0,0.35);
}

[data-theme="light"] .avatar {
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--border);
}