/* CarbonPulse Design System */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  --carbon-dark: #0d1117;
  --carbon-mid: #161b22;
  --carbon-surface: #1c2128;
  --carbon-border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent-green: #3fb950;
  --accent-bright: #00e676;
  --warning: #f9a825;
  --error: #ef5350;
}

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

html, body {
  background: #111;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: 'Syne', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* Phone frame wrapper for desktop viewing */
.phone-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 0;
}

.phone-frame {
  width: 390px;
  min-height: 844px;
  max-height: 844px;
  background: var(--carbon-dark);
  border-radius: 44px;
  border: 3px solid var(--carbon-border);
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 80px rgba(63, 185, 80, 0.06), 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

/* Status bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px 8px;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.status-bar .time { font-weight: 600; }
.status-bar .icons { display: flex; gap: 6px; align-items: center; font-size: 12px; }

/* Screen content area */
.screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
  scrollbar-width: none;
}

.screen-content::-webkit-scrollbar { display: none; }

/* Bottom navigation */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 16px 28px;
  background: var(--carbon-mid);
  border-top: 1px solid var(--carbon-border);
  flex-shrink: 0;
}

.bottom-nav a, .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.bottom-nav a:hover, .nav-item:hover { color: var(--text-secondary); }
.bottom-nav a.active, .nav-item.active { color: var(--accent-green); }

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Screen header */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0 16px;
}

.screen-header h1 {
  font-size: 24px;
  font-weight: 700;
}

/* Cards */
.card {
  background: var(--carbon-surface);
  border: 1px solid var(--carbon-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.card-sm {
  background: var(--carbon-surface);
  border: 1px solid var(--carbon-border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

/* Buttons */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--accent-green);
  color: var(--carbon-dark);
  border: none;
  border-radius: 100px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-bright); }

.btn-outline {
  display: block;
  width: 100%;
  padding: 14px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--carbon-border);
  border-radius: 100px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s;
}

.btn-outline:hover { border-color: var(--accent-green); color: var(--accent-green); }

.btn-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
}

.badge-green {
  background: rgba(63, 185, 80, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(63, 185, 80, 0.25);
}

.badge-gold {
  background: rgba(249, 168, 37, 0.12);
  color: var(--warning);
  border: 1px solid rgba(249, 168, 37, 0.25);
}

.badge-red {
  background: rgba(239, 83, 80, 0.12);
  color: var(--error);
}

.badge-neutral {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--carbon-border);
}

/* Score ring */
.score-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 12px;
}

.score-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent-green) 0% 73%, rgba(255,255,255,0.06) 73% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 12px;
}

.score-ring::before {
  content: '';
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--carbon-dark);
  position: absolute;
}

.score-ring .score-num {
  position: relative;
  z-index: 1;
  font-family: 'Syne', sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: var(--accent-green);
  line-height: 1;
}

.score-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* Activity list */
.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
}

.activity-row:last-child { border-bottom: none; }

.activity-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-name { font-size: 14px; }
.activity-kg { font-size: 13px; color: var(--text-muted); margin-left: 4px; }

.change-down {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(63, 185, 80, 0.12);
  color: var(--accent-green);
}

.change-up {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(239, 83, 80, 0.12);
  color: var(--error);
}

.change-none {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
}

/* Leaderboard */
.leaderboard-row {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
  gap: 12px;
  background: var(--carbon-surface);
  border: 1px solid transparent;
}

.leaderboard-row.you {
  background: rgba(63, 185, 80, 0.06);
  border-color: rgba(63, 185, 80, 0.2);
}

.lb-rank {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.leaderboard-row.you .lb-rank { color: var(--accent-green); }

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--carbon-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.lb-info { flex: 1; }
.lb-name { font-size: 14px; font-weight: 500; }
.lb-streak { font-size: 11px; color: var(--warning); margin-left: 6px; }
.lb-improvement {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-green);
  flex-shrink: 0;
}

/* Filter pills */
.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-pill {
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--carbon-border);
  color: var(--text-secondary);
  background: transparent;
  transition: all 0.2s;
}

.filter-pill.active {
  background: var(--accent-green);
  color: var(--carbon-dark);
  border-color: var(--accent-green);
}

/* Trust badges row */
.trust-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}

.trust-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

.trust-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(63, 185, 80, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Celebration state */
.celebration {
  text-align: center;
  padding: 32px 0 16px;
}

.check-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(63, 185, 80, 0.12);
  border: 2px solid var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 36px;
}

/* Utility */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--accent-green); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-row { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* Grid background for onboarding */
.grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: linear-gradient(var(--carbon-border) 1px, transparent 1px),
                    linear-gradient(90deg, var(--carbon-border) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Glow effect */
.glow-bg {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 300px;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(63,185,80,0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* Confidence dot */
.conf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
  margin-right: 4px;
}

/* Offset card option */
.offset-option {
  background: var(--carbon-surface);
  border: 1px solid var(--carbon-border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.offset-option:hover { border-color: rgba(63,185,80,0.3); }

.offset-option.selected { border-color: var(--accent-green); }

/* Shareable receipt card */
.receipt-card {
  background: linear-gradient(135deg, rgba(63,185,80,0.08), rgba(0,230,118,0.04));
  border: 1px solid rgba(63,185,80,0.2);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
}

/* Scan overlay */
.scan-area {
  background: var(--carbon-mid);
  border-radius: 16px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--carbon-border);
}

.scan-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green);
  top: 50%;
}

.scan-corners {
  position: absolute;
  inset: 16px;
  border: 2px solid rgba(63,185,80,0.4);
  border-radius: 8px;
}

/* Extracted item */
.extracted-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(48,54,61,0.4);
}

.extracted-item:last-child { border-bottom: none; }

.edit-icon {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent-green);
}
