/* ==========================================
   CANDIBEAN PREMIUM PWA DESIGN SYSTEM
   ========================================== */

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

:root {
  /* Colors */
  --bg-dark: #2A2A2A; /* Charcoal background */
  --bg-card: rgba(30, 30, 30, 0.65); /* SurfaceDark/1E1E1E background */
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-secondary: #D9D9D9; /* Silver */
  
  --primary: #00897B; /* CandibeanTeal */
  --primary-glow: rgba(0, 137, 123, 0.4);
  --primary-dark: #004D40;
  
  --teal: #4DB6AC; /* CandibeanOrange (Mint) */
  --teal-glow: rgba(77, 182, 172, 0.35);
  
  --orange: #4DB6AC;
  --gold: #C9A227; /* Coin Gold */
  --green: #4CAF50; /* SuccessGreen */
  --red: #B00020; /* ErrorRed */
  --gray: #D9D9D9; /* Silver */

  /* Gradients */
  --grad-wallet: linear-gradient(135deg, #004D40 0%, #00695C 50%, #00897B 100%);
  --grad-neon: linear-gradient(135deg, var(--primary) 0%, var(--teal) 100%);
  --grad-card: linear-gradient(145deg, rgba(30, 30, 30, 0.4) 0%, rgba(20, 20, 20, 0.8) 100%);

  /* Borders & Shadows */
  --border-glass: 1px solid rgba(255, 255, 255, 0.08);
  --border-active: 1px solid rgba(0, 137, 123, 0.5);
  --shadow-neon: 0 8px 32px 0 rgba(0, 137, 123, 0.25);
  --shadow-inset: inset 0 2px 8px rgba(255, 255, 255, 0.05);

  /* Layout Constants */
  --max-width: 480px;
  --bottom-bar-height: 72px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: #121212;
  color: var(--text-white);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: -webkit-fill-available; /* Safe viewport for iOS */
  overflow: hidden;
}

/* iOS Safari stand-alone safe height fixes */
html {
  height: -webkit-fill-available;
}

/* App Shell container (Simulates a mobile display on Desktop) */
#app-shell {
  width: 100%;
  max-width: var(--max-width);
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for modern browsers */
  background: radial-gradient(circle at top right, #004D40 0%, var(--bg-dark) 65%),
              radial-gradient(circle at bottom left, #1c3330 0%, var(--bg-dark) 100%);
  border-left: var(--border-glass);
  border-right: var(--border-glass);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.8);
}

/* Header (Top Action Bar) */
header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-glass);
  background: rgba(6, 5, 14, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
}

header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grad-neon);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-white);
  border: 2px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  box-shadow: 0 0 10px rgba(191, 28, 139, 0.4);
}

header .welcome-text h4 {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
}

header .welcome-text h2 {
  font-size: 17px;
  font-weight: 700;
}

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

header .btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

header .btn-icon:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.92);
}

header .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid var(--bg-dark);
}

/* Main Scrollable View Area */
main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px calc(var(--bottom-bar-height) + 24px) 20px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for element */
main::-webkit-scrollbar {
  display: none;
}

/* Bottom Navigation Bar */
nav.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--bottom-bar-height);
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom); /* iOS home bar safe area padding */
  z-index: 100;
}

nav.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  width: 64px;
  height: 100%;
  transition: all 0.2s ease;
}

nav.bottom-nav .nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: all 0.2s ease;
}

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

nav.bottom-nav .nav-item.active svg {
  stroke: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
  transform: translateY(-2px);
}

/* View Navigation Controllers (SPA View Manager) */
.view {
  display: none;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.view.active {
  display: block;
}

/* Keyframe Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulseNeon {
  0% { box-shadow: 0 0 10px rgba(0, 137, 123, 0.3); }
  50% { box-shadow: 0 0 25px rgba(0, 137, 123, 0.7); }
  100% { box-shadow: 0 0 10px rgba(0, 137, 123, 0.3); }
}

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

/* Utility Classes */
.text-glow-primary {
  text-shadow: 0 0 10px var(--primary-glow);
}
.text-glow-teal {
  text-shadow: 0 0 10px var(--teal-glow);
}
.d-none {
  display: none !important;
}

/* Central Overlapping FAB styles */
.fab-scan {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--grad-neon);
  box-shadow: 0 6px 20px var(--primary-glow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: 20px; /* elevated above the nav bar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 105;
  cursor: pointer;
  border: 4px solid #1E1E1E; /* surface border to cut through nav background */
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-scan svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-white);
  stroke-width: 2.5;
  fill: none;
}

.fab-scan:active {
  transform: translateX(-50%) scale(0.9) translateY(4px);
  box-shadow: 0 2px 8px var(--primary-glow);
}
