/* Return Mail — Shared Styles */

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

:root {
  /* Primary — Vibrant environmental green */
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --primary-glow: rgba(16, 185, 129, 0.15);

  /* Neutrals — Warm-tinted Stone grays */
  --text: #1c1917;
  --text-muted: #78716c;
  --text-light: #a8a29e;
  --bg: #fafaf9;
  --bg-alt: #f5f5f4;
  --bg-dark: #e7e5e4;
  --border: #d6d3d1;
  --border-light: #e7e5e4;

  /* Semantic */
  --success: #22c55e;
  --success-light: #dcfce7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* Shadows — softer */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;
}

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

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* ─── Header ──────────────────────────────────── */

.header {
  text-align: center;
  padding: 24px 16px 16px;
}

.logo {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--primary);
  text-decoration: none;
  display: inline-block;
}

.logo:hover { opacity: 0.9; }

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 12px 0 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Cards ───────────────────────────────────── */

.card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

.card-header {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Forms ───────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.95rem;
}

.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.optional-tag {
  background: var(--bg-alt);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  margin-left: 6px;
  vertical-align: middle;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg);
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea { min-height: 80px; resize: vertical; }

/* ─── Buttons ─────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--border); cursor: not-allowed; }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--bg-alt); }

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

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

.btn-danger:hover { background: #dc2626; }

/* ─── Step Indicator ──────────────────────────── */

.steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  padding: 0 20px;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
  flex-shrink: 0;
}

.step-dot.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.step-dot.completed {
  background: var(--success);
  color: white;
}

.step-line {
  height: 2px;
  width: 60px;
  background: var(--border);
  transition: background 0.3s;
}

.step-line.completed { background: var(--success); }

/* ─── Photo Upload ────────────────────────────── */

.photo-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.photo-zone:hover,
.photo-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.photo-zone input[type="file"] { display: none; }

.photo-zone-icon { font-size: 3rem; margin-bottom: 8px; }

.photo-zone-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.photo-zone-text small {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-light);
}

.camera-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 12px;
  border: none;
  cursor: pointer;
}

.camera-btn:hover { background: var(--primary-dark); }

.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.photo-thumb {
  position: relative;
  width: 80px;
  height: 80px;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

.photo-thumb .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--error);
  color: white;
  border: 2px solid white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

/* ─── OCR Result ──────────────────────────────── */

.ocr-result {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  border-left: 3px solid var(--primary);
}

.ocr-confidence {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ocr-confidence .high { color: var(--success); font-weight: 600; }
.ocr-confidence .medium { color: var(--warning); font-weight: 600; }
.ocr-confidence .low { color: var(--error); font-weight: 600; }

.ocr-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

.ocr-loading .spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ─── Status Badges ───────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
}

.status-submitted { background: var(--info-light); color: var(--info); }
.status-processing { background: var(--warning-light); color: var(--warning); }
.status-sender_notified { background: var(--primary-light); color: var(--primary); }
.status-resolved { background: var(--success-light); color: #16a34a; }

/* ─── Badge Display ───────────────────────────── */

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-alt);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.badge.earned {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

/* ─── Impact Counter ──────────────────────────── */

.impact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.impact-stat {
  text-align: center;
  padding: 16px 8px;
  background: var(--bg-alt);
  border-radius: var(--radius);
}

.impact-stat .number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.impact-stat .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Status Pipeline ─────────────────────────── */

.status-pipeline {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  overflow-x: auto;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text-light);
}

.pipeline-step.active {
  color: var(--primary);
  font-weight: 600;
}

.pipeline-step.done {
  color: var(--success);
}

.pipeline-arrow {
  color: var(--border);
  font-size: 0.7rem;
}

/* ─── Submission List ─────────────────────────── */

.submission-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
}

.submission-item:last-child { border-bottom: none; }
.submission-item:hover { background: var(--bg-alt); }

.submission-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--bg-alt);
  flex-shrink: 0;
}

.submission-info { flex: 1; min-width: 0; }

.submission-info .id {
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.submission-info .addressee {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.submission-info .date {
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ─── Success Animation ───────────────────────── */

.success-screen {
  text-align: center;
  padding: 40px 20px;
}

.success-screen .icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.success-screen h2 {
  color: var(--success);
  margin-bottom: 8px;
}

.success-screen .submission-id {
  background: var(--bg-alt);
  border: 2px solid var(--primary);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-block;
  margin: 16px 0;
}

.success-screen .points-earned {
  background: var(--primary-light);
  padding: 12px 20px;
  border-radius: var(--radius);
  color: var(--primary-dark);
  font-weight: 600;
  margin: 12px 0;
  display: inline-block;
}

/* ─── Admin ───────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

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

.stat-card .number {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Modal ───────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

/* ─── Privacy Notice ──────────────────────────── */

.privacy-notice {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.privacy-notice strong { color: var(--text); }

/* ─── Empty State ─────────────────────────────── */

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

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ─── Responsive ──────────────────────────────── */

@media (max-width: 400px) {
  .container { padding: 12px; }
  .card { padding: 18px; }
  .impact-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.35rem; }
}

/* ─── Utility ─────────────────────────────────── */

.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ─── New Design System Components ──────────── */

/* Hero Stats (Impact Page) */
.hero-stat {
  text-align: center;
  padding: var(--space-8, 32px) var(--space-4, 16px);
}
.hero-stat .number {
  font-size: var(--text-6xl, 3.75rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}
.hero-stat .unit {
  font-size: var(--text-lg, 1.125rem);
  font-weight: 600;
  color: var(--text-muted);
  margin-top: var(--space-1, 4px);
}
.hero-stat .label {
  font-size: var(--text-sm, 0.875rem);
  color: var(--text-light);
  margin-top: var(--space-2, 8px);
}

/* Navigation Bar — sticky glass */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 249, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-3, 12px) var(--space-4, 16px);
}

/* Green gradient background section */
.gradient-bg {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 50%, #6ee7b7 100%);
  padding: var(--space-12, 48px) var(--space-4, 16px);
  border-radius: var(--radius-2xl, 24px);
  margin: var(--space-8, 32px) 0;
}

/* Badge pill */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-xs, 0.75rem);
  font-weight: 600;
}

/* ─── Animations ──────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes countUp {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fadeIn { animation: fadeIn 0.3s ease-out; }
.animate-slideUp { animation: slideUp 0.4s ease-out; }
.animate-countUp { animation: countUp 1.5s ease-out; }

/* Card hover lift */
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
