/* ============================================
   main.css - NeoAviator Design System
   Theme: Smoky White / Light Grey Modern
   ============================================ */

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

/* ---------- CSS Variables ---------- */
:root {
  /* Colors */
  --bg-primary:    #f4f5f7;
  --bg-secondary:  #ffffff;
  --bg-card:       #ffffff;
  --bg-overlay:    rgba(255, 255, 255, 0.85);

  --surface-1:     #eef0f4;
  --surface-2:     #e2e5eb;
  --surface-3:     #d4d8e2;

  --accent:        #6c5ce7;
  --accent-light:  #a29bfe;
  --accent-dark:   #5a4fcf;
  --accent-glow:   rgba(108, 92, 231, 0.15);

  --green:         #00b894;
  --green-light:   #55efc4;
  --red:           #e17055;
  --red-light:     #fab1a0;
  --yellow:        #fdcb6e;
  --blue:          #74b9ff;

  --text-primary:  #1a1d2e;
  --text-secondary:#4a4e69;
  --text-muted:    #8892a4;
  --text-inverse:  #ffffff;

  --border:        #e2e5eb;
  --border-focus:  #6c5ce7;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-lg:     0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-accent: 0 8px 32px rgba(108, 92, 231, 0.25);

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  /* Typography */
  --font-main: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.2s var(--ease);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.page-content {
  padding: var(--space-xl);
  overflow-y: auto;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: var(--space-xl) var(--space-md);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  padding: 0 var(--space-sm);
}

.sidebar-logo .logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 var(--space-sm);
  margin: var(--space-lg) 0 var(--space-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-link .icon { font-size: 1.1rem; width: 20px; }

.sidebar-footer { margin-top: auto; }

.user-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  cursor: pointer;
  transition: background var(--transition);
}
.user-card:hover { background: var(--surface-2); }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.85rem;
}
.user-info .user-name { font-size: 0.88rem; font-weight: 600; }
.user-info .user-role { font-size: 0.72rem; color: var(--text-muted); }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---------- Stat Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.accent::before  { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card.green::before   { background: linear-gradient(90deg, var(--green), var(--green-light)); }
.stat-card.red::before     { background: linear-gradient(90deg, var(--red), var(--red-light)); }
.stat-card.yellow::before  { background: linear-gradient(90deg, var(--yellow), #e17055); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: var(--space-sm);
}

.stat-icon.accent { background: var(--accent-glow); }
.stat-icon.green  { background: rgba(0, 184, 148, 0.1); }
.stat-icon.red    { background: rgba(225, 112, 85, 0.1); }
.stat-icon.yellow { background: rgba(253, 203, 110, 0.15); }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-success {
  background: linear-gradient(135deg, var(--green), #00cec9);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 184, 148, 0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4); }

.btn-danger {
  background: linear-gradient(135deg, var(--red), #d63031);
  color: white;
  box-shadow: 0 4px 12px rgba(225, 112, 85, 0.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(225, 112, 85, 0.4); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success { background: rgba(0,184,148,0.12); color: var(--green); }
.badge-danger  { background: rgba(225,112,85,0.12); color: var(--red); }
.badge-warning { background: rgba(253,203,110,0.15); color: #e17055; }
.badge-info    { background: rgba(116,185,255,0.15); color: #0984e3; }
.badge-accent  { background: var(--accent-glow); color: var(--accent); }

/* ---------- Table ---------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead tr {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--surface-1);
  color: var(--text-secondary);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-1); }

/* ---------- Page Header ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Toast / Alerts ---------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  min-width: 280px;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border-left: 4px solid;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideUp 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.success { border-color: var(--green); }
.toast.error   { border-color: var(--red); }
.toast.info    { border-color: var(--accent); }

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

/* ---------- Top Bar (mobile) ---------- */
.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ---------- Wallet Balance Strip ---------- */
.balance-strip {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  color: white;
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.balance-strip::after {
  content: '';
  position: absolute;
  top: -30%; right: -10%;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.balance-label { font-size: 0.85rem; opacity: 0.8; margin-bottom: var(--space-sm); font-weight: 500; }
.balance-amount {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.balance-sub { font-size: 0.8rem; opacity: 0.7; margin-top: var(--space-xs); }

/* ---------- Quick Actions ---------- */
.quick-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  flex-wrap: wrap;
}

.quick-action-btn {
  flex: 1;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  color: white;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
  backdrop-filter: blur(4px);
}
.quick-action-btn:hover { background: rgba(255,255,255,0.22); }

/* ---------- Activity List ---------- */
.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--surface-1);
}
.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.activity-info { flex: 1; }
.activity-title { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.activity-time  { font-size: 0.75rem; color: var(--text-muted); }
.activity-amount { font-weight: 700; font-size: 0.9rem; }
.activity-amount.positive { color: var(--green); }
.activity-amount.negative { color: var(--red); }

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(244,245,247,0.8);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,29,46,0.4);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  width: 90%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-backdrop.open .modal { transform: translateY(0); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: var(--space-md); }
.empty-state p { font-size: 0.9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .page-content { padding: var(--space-md); }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .balance-amount { font-size: 2rem; }
  .quick-actions { gap: var(--space-sm); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
