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

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background-color: #F8FAFC;
  color: #0F172A;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Mobile-first Customer Viewport Container */
.mobile-shell {
  width: 100%;
  max-width: 430px;
  min-height: calc(100vh - 46px);
  margin: 0 auto;
  background-color: #F8FAFC;
  position: relative;
  display: flex;
  flex-direction: column;
}

body.auth-mode .mobile-shell {
  min-height: 100vh;
}

body.auth-mode .toast-container {
  top: 16px;
}

@media (min-width: 480px) {
  body.customer-body {
    background: linear-gradient(180deg, #F1F5F9 0%, #F8FAFC 100%);
  }

  .mobile-shell {
    margin-top: 12px;
    margin-bottom: 16px;
    min-height: calc(100vh - 74px);
    border-radius: 32px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow:
      0 25px 50px -12px rgba(15, 23, 42, 0.08),
      0 0 0 1px rgba(255, 255, 255, 0.7) inset;
    overflow: hidden;
  }

  body.auth-mode .mobile-shell {
    margin-top: 16px;
    margin-bottom: 16px;
    min-height: calc(100vh - 32px);
  }
}

/* Hero Balance Card */
.hero-balance-card {
  background: linear-gradient(135deg, #0B1528 0%, #152852 50%, #1E3A8A 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 36px -12px rgba(11, 21, 40, 0.38);
}

.hero-balance-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.22) 0%, transparent 70%);
  pointer-events: none;
}

.hero-balance-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Quick Action Buttons */
.quick-action-btn {
  transition: transform 0.22s var(--ease-out-expo), box-shadow 0.22s var(--ease-out-expo), background-color 0.2s ease;
}

.quick-action-btn:hover {
  transform: translateY(-2px);
}

.quick-action-btn:active {
  transform: scale(0.94);
}

/* Transaction Item Micro-Interaction */
.tx-card {
  transition: transform 0.22s var(--ease-out-expo), box-shadow 0.22s var(--ease-out-expo), border-color 0.2s ease;
}

.tx-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(15, 23, 42, 0.08);
  border-color: #CBD5E1;
}

.tx-card:active {
  transform: scale(0.99);
}

/* Global Full-Screen Process Loader */
.process-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-smooth);
}

.process-loader-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.process-loader-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  padding: 26px 32px;
  min-width: 240px;
  max-width: 320px;
  box-shadow:
    0 24px 48px -12px rgba(15, 23, 42, 0.28),
    0 0 0 1px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: scale(0.95);
  transition: transform 0.25s var(--ease-out-expo);
}

.process-loader-overlay.active .process-loader-card {
  transform: scale(1);
}

.spinner-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3.5px solid #DBEAFE;
  border-top-color: #2563EB;
  border-right-color: #1E3A8A;
  animation: spin-loader 0.78s cubic-bezier(0.55, 0.25, 0.45, 0.75) infinite;
}

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

/* Bottom Sheet Modal Animation (Customer) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-smooth);
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet-panel {
  width: 100%;
  max-width: 430px;
  max-height: 90vh;
  overflow-y: auto;
  background: #FFFFFF;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 12px 22px 28px;
  box-shadow: 0 -20px 50px rgba(15, 23, 42, 0.18);
  transform: translateY(100%);
  transition: transform 0.36s var(--ease-out-expo);
}

.sheet-backdrop.open .sheet-panel {
  transform: translateY(0);
}

/* Centered Modal (Admin & Receipts) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease-smooth);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s var(--ease-out-expo);
}

.modal-backdrop.open .modal-panel {
  transform: translateY(0) scale(1);
}

/* User-Added Virtual Card Gradients */
.card-brand-visa {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 60%, #2563EB 100%);
}
.card-brand-mastercard {
  background: linear-gradient(135deg, #18181B 0%, #7C2D12 55%, #EA580C 100%);
}
.card-brand-amex {
  background: linear-gradient(135deg, #064E3B 0%, #047857 55%, #0D9488 100%);
}
.card-brand-discover {
  background: linear-gradient(135deg, #312E81 0%, #4F46E5 60%, #7C3AED 100%);
}
.card-brand-other {
  background: linear-gradient(135deg, #1E293B 0%, #334155 60%, #475569 100%);
}

.card-frozen-filter {
  filter: grayscale(0.7) contrast(0.92);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.24);
  animation: toast-in 0.3s var(--ease-out-expo) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Subtle Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
