/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--grad-emerald);
  color: #040815;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.4);
}

.btn-orange {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 18px rgba(244, 63, 94, 0.25);
}
.btn-orange:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.45);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-color: var(--border-bright);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--purple);
  color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; min-height: 36px; }
.btn-lg { padding: 14px 28px; font-size: 1rem; min-height: 52px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled, .btn-loading { opacity: 0.6; cursor: not-allowed; pointer-events: none; transform: none !important; }
.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── CARDS ──────────────────────────────────────────────────────*/
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
}
.card-glass {
  background: rgba(11, 15, 25, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
}
.card-hover { transition: var(--transition); cursor: pointer; }
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.3);
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── STAT CARDS ─────────────────────────────────────────────────*/
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(18, 24, 36, 0.5);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--radius-lg);
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.stat-card .stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.stat-card .stat-trend { font-size: 0.8rem; display: flex; align-items: center; gap: 4px; }
.stat-card .stat-trend.up { color: var(--accent-green); }
.stat-card .stat-trend.down { color: var(--danger); }

/* ── BADGES ─────────────────────────────────────────────────────*/
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-pending { background: var(--warning-dim); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-processing { background: var(--info-dim); color: var(--info); border-color: rgba(59, 130, 246, 0.2); }
.badge-in_progress { background: var(--info-dim); color: var(--info); border-color: rgba(59, 130, 246, 0.2); }
.badge-completed { background: var(--accent-green-dim); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.2); }
.badge-partial { background: var(--accent-orange-dim); color: var(--accent-orange); border-color: rgba(244, 63, 94, 0.2); }
.badge-cancelled { background: var(--danger-dim); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-refunded { background: rgba(168, 85, 247, 0.12); color: #c084fc; border-color: rgba(168, 85, 247, 0.2); }
.badge-failed { background: var(--danger-dim); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-open { background: var(--info-dim); color: var(--info); border-color: rgba(59, 130, 246, 0.2); }
.badge-answered { background: var(--accent-green-dim); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.2); }
.badge-closed { background: var(--bg-elevated); color: var(--text-muted); border-color: var(--border); }
.badge-deposit { background: var(--accent-green-dim); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.2); }
.badge-order { background: var(--danger-dim); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-refund { background: rgba(168, 85, 247, 0.12); color: #c084fc; border-color: rgba(168, 85, 247, 0.2); }
.badge-bonus { background: var(--warning-dim); color: var(--warning); border-color: rgba(245, 158, 11, 0.2); }
.badge-admin { background: var(--accent-orange-dim); color: var(--accent-orange); border-color: rgba(244, 63, 94, 0.2); }
.badge-user { background: var(--bg-elevated); color: var(--text-muted); border-color: var(--border); }
.badge-active { background: var(--accent-green-dim); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.2); }
.badge-banned { background: var(--danger-dim); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge-inactive { background: var(--bg-elevated); color: var(--text-muted); border-color: var(--border); }

/* ── FORMS ──────────────────────────────────────────────────────*/
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); }
.form-label span { color: var(--danger); margin-left: 2px; }

.input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(6, 8, 20, 0.6);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: var(--transition);
  min-height: 46px;
}
.input:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15), 0 0 14px rgba(168, 85, 247, 0.25);
  background: rgba(6, 8, 20, 0.85);
}
.input::placeholder { color: var(--text-muted); opacity: 0.7; }
.input:disabled { opacity: 0.4; cursor: not-allowed; }
select.input { cursor: pointer; }
textarea.input { resize: vertical; min-height: 100px; line-height: 1.5; }
.input-error { border-color: var(--danger) !important; box-shadow: 0 0 10px rgba(239, 68, 68, 0.25) !important; }
.form-error { font-size: 0.8rem; color: var(--danger); display: none; margin-top: 2px; }
.form-error.visible { display: block; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.input-prefix { position: relative; }
.input-prefix .prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  font-weight: 600;
}
.input-prefix .input { padding-left: 52px; }

/* iOS Toggle */
.toggle-wrapper { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  transition: var(--transition);
  cursor: pointer;
}
.toggle input:checked ~ .toggle-track { background: var(--accent-green); border-color: var(--accent-green); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked ~ .toggle-track::after { transform: translateX(20px); }

/* ── TABLES ─────────────────────────────────────────────────────*/
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(11, 15, 25, 0.4);
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 14px 18px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.table .truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* ── MODAL ──────────────────────────────────────────────────────*/
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
  padding: 16px;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(168, 85, 247, 0.1);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.modal-body { margin-bottom: 20px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ── PAGINATION ─────────────────────────────────────────────────*/
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.page-btn:hover { border-color: var(--purple); color: #fff; background: rgba(255, 255, 255, 0.06); }
.page-btn.active { background: var(--purple); color: #fff; border-color: var(--purple); font-weight: 700; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── TABS ───────────────────────────────────────────────────────*/
.tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  width: fit-content;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-muted);
  min-height: 38px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── QUICK AMOUNT PILLS ─────────────────────────────────────────*/
.amount-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.amount-pill {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
  color: var(--text-muted);
}
.amount-pill:hover, .amount-pill.active {
  background: var(--accent-green-dim);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* ── EMPTY STATE ────────────────────────────────────────────────*/
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state p { font-size: 0.9rem; }

/* ── ANNOUNCEMENTS ──────────────────────────────────────────────*/
.announcement {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid transparent;
  margin-bottom: 10px;
}
.announcement.info { background: var(--info-dim); border-color: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.announcement.warning { background: var(--warning-dim); border-color: rgba(245, 158, 11, 0.2); color: #fde047; }
.announcement.success { background: var(--accent-green-dim); border-color: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.announcement svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.announcement .ann-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.announcement .ann-body { font-size: 0.85rem; color: var(--text-muted); }

/* ── ALERT BANNER ───────────────────────────────────────────────*/
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-success { background: var(--accent-green-dim); color: var(--accent-green); border-color: rgba(16, 185, 129, 0.25); }
.alert-error { background: var(--danger-dim); color: #fca5a5; border-color: rgba(239, 68, 68, 0.25); }
.alert-info { background: var(--info-dim); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }

/* ── CODE BLOCK ─────────────────────────────────────────────────*/
pre.code-block {
  background: #04060b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  color: #a5f3fc;
  line-height: 1.6;
}
.copy-btn { position: relative; }

/* ── Responsive two-column grid utility ─────────────────────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .two-col-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ── Responsive add-funds / order layout ────────────────────── */
.side-panel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 768px) {
  .side-panel-layout {
    grid-template-columns: 1fr;
  }
  .side-panel-layout .panel-sticky {
    position: static !important;
  }
}

/* ── Table mobile — stacked card rows ───────────────────────── */
@media (max-width: 768px) {
  .table-wrapper {
    overflow-x: visible;
    border: none !important;
    background: transparent;
    border-radius: 0;
  }
  .table thead { display: none; }
  .table, .table tbody { display: block; width: 100%; }
  .table tbody tr {
    display: block;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    padding: 2px 0;
    background: var(--bg-surface);
  }
  .table tbody tr:hover { background: var(--bg-elevated); }
  .table td {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.83rem;
    min-width: 0;
    gap: 12px;
  }
  .table td:last-child { border-bottom: none; }
  .table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 80px;
    min-width: 80px;
  }
  .table td:has(> input[type="checkbox"]) { display: none; }
  .table td .table-actions {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .table td .truncate,
  .table td [style*="text-overflow:ellipsis"],
  .table td [style*="text-overflow: ellipsis"] {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }
  .table .hide-mobile { display: none !important; }
  .table td[style*="max-width"] { max-width: unset !important; }
}
