/* ============================================
   Titan Financial Group — Main Stylesheet
   Font: Plus Jakarta Sans
   ============================================ */

:root {
  --bg:        #08090f;
  --bg2:       #0d1117;
  --bg3:       #161b26;
  --surface:   #1a2035;
  --surface2:  #1f2840;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.13);
  --text:      #e8eaf2;
  --text2:     #8b95b0;
  --text3:     #4f5a72;
  --accent:    #c9a84c;
  --accent2:   #a8883a;
  --accent-bg: rgba(201,168,76,0.1);
  --green:     #22c55e;
  --red:       #ef4444;
  --amber:     #f59e0b;
  --purple:    #a78bfa;
  --teal:      #14b8a6;
  --font:      'Plus Jakarta Sans', sans-serif;
  --mono:      'DM Mono', 'Courier New', monospace;
  --sidebar-w: 240px;
  --topbar-h:  60px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 32px rgba(0,0,0,0.55);
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── App layout (dashboard pages only) ────── */
body.app-layout {
  display: flex;
}

/* ── AUTH PAGES ───────────────────────────── */
/* Full viewport centering — works independently of body flex */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 24px;
  background: var(--bg);
  background-image: radial-gradient(rgba(201,168,76,0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 0 0 1px rgba(201,168,76,0.08), 0 24px 60px rgba(0,0,0,0.6);
  flex-shrink: 0;
}

.auth-logo     { text-align: center; margin-bottom: 28px; }
.auth-title    { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.auth-subtitle { font-size: 13px; color: var(--text2); margin-bottom: 24px; }
.auth-link     { color: var(--accent); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-footer   { text-align: center; font-size: 13px; color: var(--text2); margin-top: 20px; }

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
/* Invert logo to white on dark backgrounds */
.sidebar-brand img,
.topbar-logo {
  filter: brightness(0) invert(1);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
}
.nav-item i { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item:hover  { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); border-left-color: var(--accent); }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b6520);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #0d1117;
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name  { display: block; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { display: block; font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.logout-btn { color: var(--red); font-size: 18px; padding: 6px; border-radius: 6px; text-decoration: none; transition: background 0.15s, color 0.15s; line-height: 1; }
.logout-btn:hover { background: rgba(239,68,68,0.12); color: #ff6b6b; }

/* ── Main Wrap (app pages) ────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ───────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0; z-index: 50;
}

.sidebar-toggle { display: none; background: none; border: none; color: var(--text2); font-size: 22px; cursor: pointer; padding: 4px; line-height: 1; }
.topbar-center  { flex: 1; display: flex; justify-content: center; }
.topbar-right   { display: flex; align-items: center; gap: 12px; }

.notif-btn { position: relative; color: var(--text2); font-size: 20px; text-decoration: none; padding: 4px; line-height: 1; }
.notif-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* ── Page Content ─────────────────────────── */
.page-content { flex: 1; padding: 28px; max-width: 1200px; width: 100%; }

/* ── Cards ────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.card-sm { padding: 16px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }

/* ── Wallet Cards ─────────────────────────── */
.wallet-card {
  border-radius: var(--radius-lg); padding: 22px 22px 18px;
  position: relative; overflow: hidden;
  min-height: 148px; display: flex; flex-direction: column; justify-content: space-between;
}
.wallet-card::before {
  content: ''; position: absolute; top: -30px; right: -30px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.wallet-card-usd { background: linear-gradient(135deg,#1a3050 0%,#0a1828 100%); }
.wallet-card-gbp { background: linear-gradient(135deg,#1a3028 0%,#0a1810 100%); }
.wallet-card-eur { background: linear-gradient(135deg,#2a1a10 0%,#180a04 100%); }
.wallet-card-cny { background: linear-gradient(135deg,#301a10 0%,#1a0a04 100%); }

.wallet-currency { font-size: 13px; font-weight: 600; opacity: 0.6; text-transform: uppercase; letter-spacing: 1px; }
.wallet-balance  { font-size: 28px; font-weight: 700; font-family: var(--mono); margin-top: 8px; }
.wallet-account  { font-size: 12px; opacity: 0.4; font-family: var(--mono); margin-top: auto; }

/* ── Stat Grid ────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-box  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.stat-value { font-size: 22px; font-weight: 700; font-family: var(--mono); }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.15s; text-decoration: none; white-space: nowrap;
  line-height: 1;
}
.btn-primary       { background: var(--accent); color: #0d1117; }
.btn-primary:hover { background: var(--accent2); color: #0d1117; }
.btn-secondary     { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg3); }
.btn-danger        { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-success       { background: rgba(34,197,94,0.12); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.btn-sm            { padding: 6px 12px; font-size: 12px; }
.btn-full          { width: 100%; justify-content: center; }

/* ── Forms ────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font); font-size: 14px; color: var(--text);
  outline: none; transition: border-color 0.15s; appearance: none;
}
.form-control:focus     { border-color: var(--accent); }
.form-control::placeholder { color: var(--text3); }
select.form-control     { cursor: pointer; }

/* ── Input with icon ──────────────────────── */
.input-group { position: relative; }
.input-group .form-control { padding-left: 40px; }
.input-group .input-icon {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 16px; pointer-events: none;
}
.input-group .input-eye {
  position: absolute; right: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3); font-size: 16px; cursor: pointer;
  transition: color 0.15s;
}
.input-group .input-eye:hover { color: var(--text2); }

/* ── Tables ───────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); border-bottom: 1px solid var(--border); }
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green  { background: rgba(34,197,94,0.12);  color: #4ade80; }
.badge-red    { background: rgba(239,68,68,0.12);   color: #f87171; }
.badge-amber  { background: rgba(245,158,11,0.12);  color: var(--amber); }
.badge-blue   { background: var(--accent-bg);        color: var(--accent); }
.badge-purple { background: rgba(167,139,250,0.12); color: var(--purple); }
.badge-gray   { background: rgba(255,255,255,0.07); color: var(--text2); }

/* ── Page Header ──────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title    { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.page-subtitle { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* ── Grids ────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── Alerts ───────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13.5px; margin-bottom: 18px;
  border: 1px solid transparent;
  display: flex; align-items: flex-start; gap: 10px; line-height: 1.5;
}
.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(34,197,94,0.08);  border-color: rgba(34,197,94,0.2);  color: #4ade80; }
.alert-danger  { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.2);  color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2); color: var(--amber); }
.alert-info    { background: var(--accent-bg);       border-color: rgba(201,168,76,0.2); color: var(--accent); }

/* ── Divider ──────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Crypto cards ─────────────────────────── */
.crypto-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 14px; }
.crypto-icon { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.crypto-btc  { background: rgba(247,147,26,0.15); color: #f7931a; }
.crypto-eth  { background: rgba(98,126,234,0.15);  color: #627eea; }
.crypto-usdt { background: rgba(38,161,123,0.15);  color: #26a17b; }
.crypto-name { font-size: 14px; font-weight: 600; }
.crypto-bal  { font-size: 16px; font-weight: 700; font-family: var(--mono); margin-top: 2px; }
.crypto-addr { font-size: 11px; color: var(--text3); font-family: var(--mono); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Virtual card visual ──────────────────── */
.vcard { border-radius: 14px; padding: 22px 24px; width: 100%; max-width: 340px; min-height: 192px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.vcard.visa       { background: linear-gradient(135deg,#1e3a5f,#0a1e3a); }
.vcard.mastercard { background: linear-gradient(135deg,#3d1e1e,#1e0a0a); }
.vcard::after { content: ''; position: absolute; top: -40px; right: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,0.04); }
.vcard-brand  { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.vcard-number { font-family: var(--mono); font-size: 17px; letter-spacing: 3px; margin-top: 28px; }
.vcard-meta   { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 12px; }
.vcard-holder { font-size: 13px; font-weight: 600; opacity: 0.8; }
.vcard-expiry { font-size: 12px; opacity: 0.6; }

/* ── KYC stepper ──────────────────────────── */
.kyc-steps { display: flex; margin-bottom: 32px; }
.kyc-step  { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.kyc-step:not(:last-child)::after { content: ''; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border2); }
.kyc-step.done::after   { background: var(--green); }
.kyc-step.active::after { background: linear-gradient(to right, var(--accent), var(--border2)); }
.kyc-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border2); background: var(--bg2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; z-index: 1; color: var(--text3); }
.kyc-step.done   .kyc-dot { background: var(--green);  border-color: var(--green);  color: #fff; }
.kyc-step.active .kyc-dot { background: var(--accent); border-color: var(--accent); color: #0d1117; }
.kyc-step-label { font-size: 11px; color: var(--text3); margin-top: 6px; text-align: center; }
.kyc-step.active .kyc-step-label { color: var(--text); }

/* ── Scrollbar ────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 768px) {
  .sidebar        { transform: translateX(-100%); }
  .sidebar.open   { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .topbar-logo    { display: block !important; }
  .main-wrap      { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-content   { padding: 16px; }
  .auth-box       { padding: 28px 20px; }
}