/* ===== CSS Variables ===== */
:root {
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --secondary: #10b981;
  --accent: #3b82f6;
  --danger: #ef4444;
  
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Screen Management ===== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  transition: var(--transition);
  z-index: 1;
  overflow: hidden;
  visibility: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 10;
  visibility: visible;
}

.screen.prev {
  transform: translateX(-30%);
}

/* ===== Screen Header ===== */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  flex-shrink: 0;
}

.screen-header h2 {
  font-size: 20px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

/* FIXED: Header actions container */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* FIXED: Mini streak badge on main screen */
.streak-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  border-radius: var(--radius-full);
  color: white;
  font-weight: 700;
  font-size: 14px;
  animation: pulse-streak 2s ease-in-out infinite;
}

.streak-icon-mini {
  font-size: 16px;
}

@keyframes pulse-streak {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 4px rgba(255, 107, 53, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.5);
  }
}

.screen-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  padding-bottom: 90px;
  -webkit-overflow-scrolling: touch;
}

/* ===== Welcome Screen ===== */
#welcome-screen {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.welcome-content {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.logo-large {
  margin-bottom: 24px;
}

.logo-icon {
  font-size: 80px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-title {
  font-size: 36px;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
}

.welcome-subtitle {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 48px;
  line-height: 1.6;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Buttons ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: white;
  color: #333;
  border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: var(--shadow);
}

.btn-full {
  width: 100%;
}

#btn-share-footprint {
  margin-bottom: 40px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-back, .btn-icon, .btn-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  flex-shrink: 0;
  z-index: 1;
  pointer-events: auto;
}

.btn-back:hover, .btn-icon:hover, .btn-close:hover {
  background: var(--bg-secondary);
  transform: scale(1.05);
}

.btn-back:active, .btn-icon:active, .btn-close:active {
  background: var(--bg-tertiary);
  transform: scale(0.95);
}

/* Pending scans badge - SEE LINE 1380 FOR MAIN BADGE STYLES */

/* ===== Forms ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* ===== User Card ===== */
.user-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
}

.user-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.user-level {
  font-size: 14px;
  color: var(--text-secondary);
}

.user-points {
  text-align: right;
}

.points-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.points-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== Progress Card ===== */
.progress-card {
  padding: 16px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: var(--transition);
}

.stat-card:active {
  transform: scale(0.98);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== Scan Button ===== */
.scan-button-container {
  margin-bottom: 32px;
}

.btn-scan {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 18px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: var(--transition);
}

.btn-scan:active {
  transform: scale(0.98);
  box-shadow: var(--shadow);
}

/* ===== Section Header ===== */
.section-header {
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 600;
}

/* ===== Activity List ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.activity-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.activity-info {
  flex: 1;
}

.activity-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.activity-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.activity-points {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state-hint {
  font-size: 14px;
  margin-top: 8px;
  color: var(--text-tertiary);
}

/* ===== Scanner Screen ===== */
#scanner-screen {
  background: #000;
  padding: 0;
}

.scanner-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  display: flex;
  justify-content: flex-end;
  z-index: 20;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
}

.scanner-header .btn-close {
  background: rgba(0, 0, 0, 0.5);
  color: white;
  backdrop-filter: blur(10px);
}

.scanner-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.camera-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

.camera-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.camera-placeholder svg {
  opacity: 0.5;
}

/* Full-screen video - no mirroring for back camera */
#camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* Hidden canvas for predictions */
#camera-container canvas {
  display: none;
}

.scan-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  height: 280px;
  border: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
  animation: pulse 2s ease-in-out infinite;
  z-index: 10;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.03); }
}

.scanner-result {
  position: absolute;
  bottom: 120px;
  left: 20px;
  right: 20px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  color: white;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
  pointer-events: none;
}

.scanner-result.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scanner-controls {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}

.btn-capture {
  width: 72px;
  height: 72px;
  padding: 0;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xl);
  font-size: 0;
}

.btn-capture span {
  display: none;
}

.btn-capture::after {
  content: '';
  width: 56px;
  height: 56px;
  background: white;
  border-radius: var(--radius-full);
  display: block;
}

/* ===== Statistics Screen ===== */
.stats-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.summary-icon {
  font-size: 32px;
}

.summary-content {
  flex: 1;
}

.summary-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.summary-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.waste-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.waste-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.waste-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.waste-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.waste-icon {
  font-size: 24px;
}

.waste-name {
  font-size: 16px;
  font-weight: 600;
}

.waste-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 120px;
  justify-content: flex-end;
}

.waste-count {
  font-size: 18px;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

.waste-points {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
  min-width: 48px;
  text-align: right;
}

.scan-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.history-icon {
  font-size: 24px;
}

.history-info {
  flex: 1;
}

.history-type {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.history-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.history-points {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* ===== Profile Screen ===== */
.profile-header {
  text-align: center;
  padding: 24px 0;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-lg);
}

.profile-header h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.profile-stat {
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.profile-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.profile-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.achievements {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.achievement-card.locked {
  opacity: 0.5;
}

.achievement-card.unlocked {
  box-shadow: var(--shadow);
}

.achievement-icon {
  font-size: 40px;
  filter: grayscale(1);
}

.achievement-card.unlocked .achievement-icon {
  filter: grayscale(0);
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.achievement-info {
  flex: 1;
}

.achievement-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.achievement-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 9999; /* Increased from 100 to ensure visibility above all content */
  opacity: 0;
  transform: translateY(100%);
  transition: var(--transition);
  pointer-events: none; /* Prevent interaction when hidden */
}

.bottom-nav.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto; /* Re-enable interaction when visible */
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  font-weight: 500;
}

.nav-item svg {
  transition: var(--transition);
}

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

.nav-item:active {
  background: var(--bg-tertiary);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

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

/* ===== Toast Notification ===== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
  }
  
  .screen, .bottom-nav {
    max-width: 480px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%) translateX(100%);
  }
  
  .screen.active {
    transform: translateX(-50%) translateX(0);
  }
  
  .screen.prev {
    transform: translateX(-50%) translateX(-30%);
  }
  
  .bottom-nav.visible {
    transform: translateX(-50%) translateY(0);
  }
  
  #scanner-screen {
    max-width: 100%;
    left: 0;
    transform: translateX(100%);
  }
  
  #scanner-screen.active {
    transform: translateX(0);
  }
}

/* ===== Safe Area ===== */
@supports (padding: max(0px)) {
  .screen-header {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  
  .scanner-header {
    padding-top: max(16px, env(safe-area-inset-top));
  }
}

/* ===== Enhanced Statistics ===== */
.period-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.period-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.period-btn.active {
  color: var(--primary);
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.activity-chart {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 180px;
  gap: 8px;
  margin-bottom: 16px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bar-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 140px;
  position: relative;
}

.bar {
  width: 100%;
  background: linear-gradient(to top, var(--primary), var(--secondary));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: var(--transition);
  position: relative;
}

.bar-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 6px;
}

.bar-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.waste-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.waste-progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Settings Modal ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  transition: var(--transition);
}

/* Confirmation modal centered */
#confirmation-modal {
  align-items: center;
}

.modal.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: var(--bg-primary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(100%);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.show .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
}

.btn-close-modal {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
}

.btn-close-modal:hover {
  background: var(--bg-tertiary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 100px 20px;
  -webkit-overflow-scrolling: touch;
}

.settings-section {
  margin: 24px 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.setting-label {
  flex: 1;
}

.setting-label span {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.setting-label small {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
}

.setting-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.setting-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* ===== Toggle Switch ===== */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: var(--transition);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ===== Info Items ===== */
.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 14px;
}

.info-item span:first-child {
  color: var(--text-secondary);
}

.info-item span:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Pending Scans Badge Enhancement ===== */
#pending-scans-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  background: var(--danger);
  color: white;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
  animation: pulse 2s infinite;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 2;
}

#pending-scans-badge.visible {
  opacity: 1;
  pointer-events: none; /* Badge shouldn't block clicks, parent button handles it */
}

#pending-scans-badge.has-pending {
  animation: badge-pop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes badge-pop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* ===== Confirmation Modal ===== */
.confirmation-modal {
  max-width: 360px;
  max-height: auto;
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  transform: scale(1);
}

#confirmation-modal.show .confirmation-modal {
  transform: scale(1);
  animation: scaleIn 0.3s ease-out;
}

.confirmation-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto 20px;
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

.confirmation-modal h3 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirmation-modal p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.confirmation-buttons {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.confirmation-buttons .btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  display: block !important;
  pointer-events: auto !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  opacity: 1 !important;
  visibility: visible !important;
  position: relative !important;
  z-index: 10 !important;
}
