/* ============================================
   assets/css/app.css - Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Syne:wght@700;800&display=swap');

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary: #0EA5E9;
  --accent: #F59E0B;
  --accent-light: #FEF3C7;
  --success: #10B981;
  --success-light: #D1FAE5;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --info: #6366F1;
  --info-light: #EEF2FF;

  --bg: #F0F4FF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F172A;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 16px rgba(37,99,235,.1);
  --shadow-lg: 0 8px 32px rgba(37,99,235,.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --bottom-nav-height: 68px;
  --font: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Syne', sans-serif;
}

[data-theme="dark"] {
  --bg: #0B1120;
  --bg-card: #131F35;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #1E293B;
  --border-light: #1E293B;
  --shadow: 0 4px 16px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.4);
  --primary-light: #1E3A5F;
  --accent-light: #451A03;
  --success-light: #064E3B;
  --danger-light: #450A0A;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- LAYOUT ---- */
.app-container { max-width: 680px; margin: 0 auto; min-height: 100vh; position: relative; }
.page-content { padding: 16px 16px calc(var(--bottom-nav-height) + 16px); }
@media (min-width: 768px) { .app-container { max-width: 100%; } .page-content { padding: 24px; padding-bottom: 24px; } }

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow); }
.card-glass {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.6);
}

/* ---- HERO CARD ---- */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, #1E40AF 50%, #1E3A8A 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.hero-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}

/* ---- TYPOGRAPHY ---- */
h1,h2,h3,h4,h5 { font-weight: 700; line-height: 1.3; }
.display { font-family: var(--font-display); }
.text-primary-color { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-secondary-color { color: var(--text-secondary); }
.fs-xs { font-size: 11px; }
.fs-sm { font-size: 12px; }
.fs-lg { font-size: 18px; }
.fs-xl { font-size: 24px; }
.fs-2xl { font-size: 32px; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,.35); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 16px 28px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; border-radius: 10px; width: 40px; height: 40px; }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-checkin {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff;
  font-size: 16px;
  padding: 18px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(245,158,11,.4);
  animation: pulseBtn 2s infinite;
}
.btn-checkin:hover { transform: scale(1.02); box-shadow: 0 6px 24px rgba(245,158,11,.5); }
.btn-checkin-done { background: var(--success-light); color: var(--success); cursor: not-allowed; animation: none; box-shadow: none; }

@keyframes pulseBtn {
  0%,100% { box-shadow: 0 4px 20px rgba(245,158,11,.4); }
  50% { box-shadow: 0 4px 28px rgba(245,158,11,.7); }
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 600; font-size: 13px; color: var(--text-secondary); margin-bottom: 7px; }
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }
.input-group { position: relative; }
.input-group .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; pointer-events: none; }
.input-group .form-control { padding-left: 44px; }
.input-group .input-icon-right { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); cursor: pointer; }
.input-group .form-control.pr { padding-right: 44px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--border); color: var(--text-secondary); }

/* ---- STATS ---- */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border-light);
}
.stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ---- STREAK ---- */
.streak-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.streak-day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg);
  position: relative;
  transition: all .3s;
}
.streak-day.done { background: linear-gradient(135deg, var(--primary), #7C3AED); border-color: transparent; color: #fff; }
.streak-day.done.bonus { background: linear-gradient(135deg, #F59E0B, #EF4444); }
.streak-day.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); animation: streakPulse 1.5s infinite; }
.streak-day .day-coin { font-size: 8px; color: inherit; opacity: .8; }
.streak-day .day-num { font-size: 13px; }

@keyframes streakPulse {
  0%,100% { box-shadow: 0 0 0 3px var(--primary-light); }
  50% { box-shadow: 0 0 0 6px rgba(37,99,235,.15); }
}

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 680px;
  height: var(--bottom-nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 8px;
  transition: color .2s;
  position: relative;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item i { font-size: 20px; }
.bottom-nav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 32px; height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}
.bottom-nav-center {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(245,158,11,.5);
  margin-bottom: 8px;
  border: 3px solid var(--bg-card);
  text-decoration: none;
  transition: transform .2s;
}
.bottom-nav-center:hover { transform: scale(1.08); }

/* ---- TOP NAV ---- */
.top-nav {
  background: var(--bg-card);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 50;
}
.top-nav-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--text-primary); }

/* ---- LIST ITEMS ---- */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.list-item:last-child { border-bottom: none; }
.list-icon {
  width: 42px; height: 42px; min-width: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.list-content { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-subtitle { font-size: 12px; color: var(--text-muted); }
.list-value { font-weight: 700; font-size: 14px; white-space: nowrap; }

/* ---- AUTH PAGES ---- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; }
.auth-hero {
  background: linear-gradient(160deg, #1E3A8A 0%, #2563EB 50%, #0EA5E9 100%);
  padding: 48px 24px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(255,255,255,.08) 0%, transparent 60%);
}
.auth-hero .logo { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: #fff; }
.auth-hero .tagline { color: rgba(255,255,255,.8); font-size: 14px; margin-top: 4px; }
.auth-body { background: var(--bg-card); border-radius: 24px 24px 0 0; flex: 1; padding: 32px 24px; margin-top: -16px; position: relative; }
.auth-body h2 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 4px; }
.auth-body p { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* ---- TOAST ---- */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 320px;
  animation: slideIn .3s ease;
  border-left: 4px solid var(--primary);
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- WALLET CARDS ---- */
.wallet-card {
  background: linear-gradient(135deg, #1E3A8A, #2563EB);
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
}
.wallet-card.selected { border-color: #F59E0B; box-shadow: 0 0 0 3px rgba(245,158,11,.25); }
.wallet-card .wallet-name { font-family: var(--font-display); font-size: 18px; font-weight: 800; }

/* ---- WITHDRAW AMOUNT ---- */
.amount-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.amount-btn {
  padding: 14px 8px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.amount-btn:hover { border-color: var(--primary); color: var(--primary); }
.amount-btn.selected { background: var(--primary); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.amount-btn.disabled { opacity: .4; cursor: not-allowed; }

/* ---- PROGRESS BAR ---- */
.progress { background: var(--border-light); border-radius: 50px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 50px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width .5s ease; }

/* ---- COIN DISPLAY ---- */
.coin-display {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff;
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 16px;
}
.coin-icon { font-size: 20px; }

/* ---- LOADING ---- */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; opacity: 0; visibility: hidden; transition: all .2s;
}
.loading-overlay.show { opacity: 1; visibility: visible; }
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: .3; }
.empty-state h4 { font-size: 16px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: var(--text-muted); }

/* ---- ADMIN SIDEBAR ---- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; min-height: 100vh;
  background: var(--bg-sidebar);
  position: fixed; left: 0; top: 0; bottom: 0;
  overflow-y: auto; z-index: 100;
  transition: transform .3s;
}
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-logo { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: #fff; }
.sidebar-tagline { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 2px; }
.sidebar-nav { padding: 16px 0; }
.sidebar-section { padding: 8px 20px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.25); letter-spacing: 1px; text-transform: uppercase; margin-top: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.9); }
.sidebar-link.active { background: rgba(37,99,235,.2); color: #fff; border-left-color: var(--primary); }
.sidebar-link i { width: 20px; font-size: 16px; }
.admin-content { margin-left: 260px; flex: 1; padding: 24px; background: var(--bg); }
.admin-topbar {
  background: var(--bg-card); padding: 16px 24px;
  border-radius: var(--radius); margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.admin-topbar h1 { font-size: 20px; font-weight: 800; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-content { margin-left: 0; padding: 16px; }
}

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border-light); text-align: left; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ---- MISC ---- */
.divider { height: 1px; background: var(--border-light); margin: 16px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 15px; font-weight: 700; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-0 { padding: 0; }
.overflow-hidden { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.color-success { color: var(--success); }
.color-danger { color: var(--danger); }
.color-warning { color: var(--warning); }

/* ---- COIN ANIMATION ---- */
.coin-pop {
  animation: coinPop .6s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes coinPop {
  0% { transform: scale(.5); opacity: 0; }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- RIPPLE ---- */
.ripple { position: relative; overflow: hidden; }
.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  width: 0; height: 0;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  animation: ripple .5s ease;
}
@keyframes ripple {
  to { width: 200px; height: 200px; opacity: 0; }
}

/* ---- DARK MODE TOGGLE ---- */
.theme-toggle {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 50px;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background .2s;
}
.theme-toggle.active { background: var(--primary); }
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.theme-toggle.active::after { transform: translateX(20px); }

/* ---- RESPONSIVE DESKTOP SIDEBAR NAV ---- */
@media (min-width: 768px) {
  .desktop-nav {
    background: var(--bg-card);
    border-right: 1px solid var(--border-light);
    width: 240px;
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
  }
  .main-with-sidebar { margin-left: 240px; }
}
