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

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

:root {
  --navy-900: #0a1628;
  --navy-800: #111d33;
  --navy-700: #182a45;
  --navy-600: #1e3a5f;
  --ice-400: #7ec8e3;
  --ice-300: #a8ddf0;
  --ice-200: #d0eef8;
  --white: #f0f4f8;
  --white-pure: #ffffff;
  --alert-amber: #f5a623;
  --success-green: #34d399;
  --danger-red: #ef4444;
  --text-primary: #e8edf3;
  --text-secondary: #8a9bb5;
  --text-muted: #5a6e87;
  --border: rgba(126, 200, 227, 0.12);
  --border-focus: rgba(126, 200, 227, 0.35);
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  background: var(--navy-900);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* === SNOW GRAIN OVERLAY === */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* === LAYOUT === */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* === HEADER === */
.app-header {
  padding: 20px 0 12px;
  text-align: center;
  position: relative;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(126, 200, 227, 0.08);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ice-400);
  margin-bottom: 12px;
}

.header-badge .pulse {
  width: 6px;
  height: 6px;
  background: var(--alert-amber);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.app-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--white-pure);
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-title svg {
  flex-shrink: 0;
}

.app-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 400;
}

.header-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-focus), transparent);
  margin-top: 12px;
}

/* === PROGRESS BAR (#1: tappable) === */
.progress-bar {
  padding: 12px 0 16px;
}

.progress-track {
  height: 3px;
  background: var(--navy-700);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--ice-400);
  border-radius: 2px;
  width: 25%;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
}

.progress-step {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: color 0.2s;
  background: none;
  border: none;
  padding: 4px 2px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.progress-step.done {
  color: var(--text-secondary);
  cursor: pointer;
}

.progress-step.done:active {
  color: var(--ice-400);
}

.progress-step.active {
  color: var(--ice-400);
  cursor: default;
}

/* === WIZARD STEPS === */
.wizard {
  flex: 1;
  position: relative;
}

.step {
  display: none;
  animation: fadeIn 0.25s ease;
}

.step.active {
  display: block;
}

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

.step-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white-pure);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* === CATEGORY BUTTONS === */
.category-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  background: var(--navy-800);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.category-btn:active {
  transform: scale(0.98);
}

.category-btn .cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
  background: rgba(126, 200, 227, 0.06);
  transition: background 0.15s ease;
}

.category-btn .cat-text {
  flex: 1;
}

.category-btn .cat-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.category-btn.selected {
  border-color: var(--ice-400);
  background: rgba(126, 200, 227, 0.08);
}

.category-btn.selected .cat-icon {
  background: rgba(126, 200, 227, 0.15);
}

.category-btn.selected .cat-check {
  border-color: var(--ice-400);
  background: var(--ice-400);
}

.category-btn.selected .cat-check svg {
  opacity: 1;
}

.category-btn .cat-check svg {
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* === PHOTO CAPTURE === */
.photo-capture-btn {
  width: 100%;
  padding: 48px 16px;
  background: var(--navy-800);
  border: 1.5px dashed var(--border-focus);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.photo-capture-btn:active {
  transform: scale(0.98);
}

.photo-capture-btn .cam-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--ice-400);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ice-400);
}

.photo-capture-btn.has-photo {
  padding: 0;
  border-style: solid;
  border-color: var(--ice-400);
  overflow: hidden;
  position: relative;
}

.photo-preview {
  display: none;
  width: 100%;
}

.photo-preview img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.photo-preview .photo-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--navy-800);
}

.photo-preview .photo-ok {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--success-green);
  font-weight: 600;
}

/* #4: EXIF status variants */
.photo-preview .photo-ok.no-gps {
  color: var(--text-secondary);
}

.photo-preview .photo-ok.no-gps svg {
  display: none;
}

.photo-preview .photo-retake {
  font-size: 0.85rem;
  color: var(--ice-400);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.photo-preview .photo-retake:active {
  background: rgba(126, 200, 227, 0.1);
}

.photo-capture-btn.has-photo .photo-placeholder {
  display: none;
}

.photo-capture-btn.has-photo .photo-preview {
  display: block;
}

#photoInput {
  display: none;
}

/* === LOCATION === */
.location-section {
  margin-top: 12px;
}

.location-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.detect-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(126, 200, 227, 0.1);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--ice-400);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.detect-btn:active {
  transform: scale(0.97);
}

.detect-btn.detecting {
  pointer-events: none;
  opacity: 0.7;
}

.detect-btn.detecting .detect-icon {
  animation: spin 1s linear infinite;
}

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

.text-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--navy-800);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.text-input:focus {
  border-color: var(--border-focus);
}

.text-input::placeholder {
  color: var(--text-muted);
}

.lat-lng {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'Outfit', monospace;
  letter-spacing: 0.02em;
  min-height: 1em;
}

/* #2: location helper hint */
.location-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(126, 200, 227, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.4;
}

/* === REVIEW CARD (#5: tappable rows) === */
.review-card {
  background: var(--navy-800);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 12px 0 16px;
}

.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.review-row-btn {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.review-row-btn:active {
  background: rgba(126, 200, 227, 0.05);
}

.review-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.review-value-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

.review-edit {
  color: var(--text-muted);
  flex-shrink: 0;
}

.review-photo img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

/* === FORM SECTIONS (review step) === */
.form-section {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

textarea.text-input {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  line-height: 1.5;
}

/* === CONTACT TOGGLE (#6: stacked fields) === */
.contact-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}

.contact-toggle .chevron {
  transition: transform 0.2s ease;
  font-size: 0.7rem;
}

.contact-toggle.open .chevron {
  transform: rotate(90deg);
}

.contact-fields {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  animation: slideDown 0.2s ease;
}

.contact-fields.visible {
  display: flex;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === WIZARD NAV (#8: bigger Back button) === */
.wizard-nav {
  display: flex;
  gap: 10px;
  padding: 12px 0 20px;
  margin-top: auto;
}

.nav-btn {
  padding: 15px;
  border-radius: var(--radius);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  border: none;
}

.nav-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.nav-back {
  background: var(--navy-700);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  flex: 0 0 auto;
  min-width: 80px;
  text-align: center;
}

.nav-back.hidden {
  display: none;
}

.nav-next {
  flex: 1;
  background: linear-gradient(135deg, var(--ice-400), #5ba8c8);
  color: var(--navy-900);
  letter-spacing: 0.01em;
}

.nav-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* === ERROR BANNER (#7) === */
.error-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: #fca5a5;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 10px;
  animation: fadeIn 0.25s ease;
}

.error-banner.visible {
  display: flex;
}

.error-banner svg {
  flex-shrink: 0;
  color: var(--danger-red);
}

.error-banner span {
  flex: 1;
}

.error-dismiss {
  background: none;
  border: none;
  color: #fca5a5;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* === OVERLAY === */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay.visible {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--ice-400);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.overlay-text {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* === CONFIRMATION (#9: pushed up, summary) === */
.confirmation {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px 40px;
  flex: 1;
}

.confirmation.visible {
  display: flex;
}

.confirmation .check-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.confirmation .check-circle svg {
  color: var(--success-green);
}

.confirmation h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white-pure);
  margin-bottom: 8px;
}

.confirmation p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 280px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.confirm-summary {
  width: 100%;
  max-width: 300px;
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 24px;
}

.confirm-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.82rem;
}

.confirm-summary-row + .confirm-summary-row {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.confirm-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.confirm-summary-row span:last-child {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
}

.confirmation .another-btn {
  padding: 14px 32px;
  background: var(--navy-700);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.confirmation .another-btn:active {
  transform: scale(0.97);
}

/* === FOOTER === */
.app-footer {
  padding: 10px 0 14px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* === UTILITY === */
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (min-width: 480px) {
  .app-container {
    padding: 0 24px;
  }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .wizard-nav {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
