/* ============================================================
   CashPay - shared styles
   ============================================================ */
:root {
  --primary: #FFE9A3;
  --primary-light: #FFF8D9;
  --accent: #FFD700;
  --accent-soft: #F5E6A0;
  --gold: #D4AF37;
  --text: #F5F5DC;
  --text-2: #D2B48C;
  --text-3: #CD853F;
  --text-dim: #8A6D4B;
  --bg: #1A0F0A;
  --bg-2: #2C1810;
  --card: #3D2317;
  --card-2: #4A2C1D;
  --line: rgba(255, 215, 0, 0.12);
  --success: #2ECC71;
  --danger: #E74C3C;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

img {
  display: block;
  max-width: 100%;
}

/* ---------- layout ---------- */
.page-container {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, #241208 0%, var(--bg) 40%);
  padding-bottom: 90px;
  position: relative;
  overflow-x: hidden;
}

/* ---------- header ---------- */
.common-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 233, 163, 0.95), rgba(255, 248, 217, 0.95));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: 1px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
}

.header-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.15;
  color: #3d2317;
}

.header-title small {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  color: rgba(61, 35, 23, 0.7);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-btn {
  position: relative;
  font-size: 1.25rem;
  color: #3d2317;
  padding: 6px;
}

.header-btn .badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #111;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.section {
  padding: 12px 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 14px 14px 10px;
}

.section-title .more {
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 500;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 46px;
  border-radius: 23px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #3d2317;
  border: 1px solid rgba(255, 215, 0, 0.35);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #1a0f0a;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
}

.btn-sm {
  height: 34px;
  font-size: 0.8rem;
  border-radius: 17px;
  padding: 0 16px;
  width: auto;
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- forms ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-2);
  margin-bottom: 6px;
}

.form-input-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  height: 46px;
  background: var(--bg-2);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 10px;
  padding: 0 14px;
  color: var(--text);
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-input:focus {
  border-color: var(--gold);
}

.form-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-weight: 600;
}

.form-prefix + .form-input {
  padding-left: 48px;
}

.form-suffix-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--accent);
  padding: 6px 10px;
}

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: rgba(45, 22, 12, 0.97);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 30;
  padding: 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 4px 0;
}

.bottom-nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-center {
  flex: 1.2;
}

.nav-invest-btn {
  width: 52px;
  height: 52px;
  margin-top: -22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #3d2317;
  box-shadow: 0 4px 14px rgba(255, 233, 163, 0.45);
}

/* ---------- balance hero ---------- */
.balance-hero {
  margin: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.balance-hero::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.08);
}

.balance-hero .bh-label {
  font-size: 0.72rem;
  color: rgba(61, 35, 23, 0.8);
  display: flex;
  justify-content: space-between;
}

.balance-hero .bh-value {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 6px 0 14px;
  color: #7a5a00;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.balance-hero .bh-actions {
  display: flex;
  gap: 10px;
}

.balance-hero .bh-actions .btn {
  height: 38px;
  font-size: 0.8rem;
  border-radius: 19px;
  flex: 1;
}

/* ---------- grid rows / lists ---------- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: none;
}

.row .r-label {
  color: var(--text-2);
  font-size: 0.85rem;
}

.row .r-value {
  font-weight: 600;
  font-size: 0.9rem;
}

.gold {
  color: var(--accent);
}

.green {
  color: var(--success);
}

.red {
  color: var(--danger);
}

/* ---------- grid ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

/* ---------- status badges ---------- */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-badge.pending {
  background: rgba(255, 215, 0, 0.15);
  color: var(--accent);
}

.status-badge.success {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.status-badge.rejected {
  background: rgba(231, 76, 60, 0.15);
  color: var(--danger);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -20px);
  background: rgba(30, 16, 8, 0.96);
  border: 1px solid var(--gold);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  max-width: 80vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--gold);
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.25s;
}

.modal-mask.show .modal-sheet {
  transform: translateY(0);
}

.modal-title {
  text-align: center;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---------- animations ---------- */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.animate-up {
  animation: slideUp 0.35s ease both;
}

.animate-in {
  animation: fadeIn 0.3s ease both;
}

/* ---------- empty state ---------- */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
}

.empty .empty-icon {
  font-size: 2.6rem;
  margin-bottom: 10px;
}

.empty p {
  font-size: 0.85rem;
}

/* ---------- loading ---------- */
.loading {
  display: flex;
  justify-content: center;
  padding: 30px;
}

.loading::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- scrollbar ---------- */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-thumb {
  background: var(--card-2);
  border-radius: 3px;
}

/* ---------- copy ---------- */
.copy-tip {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 8px;
  text-align: center;
}
