/* Groundfall - The Offline Field Naturalist & Sensory Walk Companion */
:root {
  --bg-primary: #0f1712;
  --bg-surface: #18251e;
  --bg-surface-elevated: #223329;
  --bg-surface-glass: rgba(24, 37, 30, 0.85);
  --border-color: #2e4437;
  --border-focus: #4e805f;
  
  --accent-green: #4ade80;
  --accent-green-dark: #15803d;
  --accent-amber: #f59e0b;
  --accent-rust: #ea580c;
  --accent-cream: #fbf7ee;
  
  --text-primary: #f0fdf4;
  --text-secondary: #9cb5a3;
  --text-muted: #5f7a67;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

/* Sunlight / High Contrast Mode */
body.sunlight-mode {
  --bg-primary: #f7f9f5;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ebf0e6;
  --bg-surface-glass: rgba(255, 255, 255, 0.95);
  --border-color: #cbd8cd;
  --border-focus: #1b4d2e;
  --accent-green: #1b6838;
  --accent-green-dark: #144927;
  --accent-amber: #b45309;
  --accent-rust: #c2410c;
  --text-primary: #122017;
  --text-secondary: #3b5243;
  --text-muted: #6b8273;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 60px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Navigation & Header */
header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 28px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 2.2rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.logo-text h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.badge-green {
  color: var(--accent-green);
  border-color: rgba(74, 222, 128, 0.3);
}

.badge-amber {
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.3);
}

.btn-icon-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-icon-toggle:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-focus);
}

/* Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent-green);
  border-bottom: 2px solid var(--accent-green);
  background: var(--bg-surface);
}

/* Tab Panels */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-content.active {
  display: block;
}

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

/* Cards & Layout */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.theme-card {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.theme-card:hover {
  border-color: var(--border-focus);
}

.theme-card.selected {
  border-color: var(--accent-green);
  background: rgba(74, 222, 128, 0.08);
}

.theme-card-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.theme-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.theme-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.duration-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.pill-btn.selected {
  background: var(--accent-green);
  color: #0f1712;
  border-color: var(--accent-green);
  font-weight: 700;
}

/* Action Buttons */
.btn-primary {
  background: var(--accent-green);
  color: #0f1712;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.3);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
}

.btn-danger {
  background: #dc2626;
  color: white;
  border: none;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Trail Walk Mode Screen */
.walk-hero {
  text-align: center;
  padding: 30px 20px;
}

.eyes-up-status-box {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.eyes-up-status-box.pocket-mode {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.eyes-up-meter {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent-green);
  line-height: 1.1;
  margin: 10px 0;
  font-feature-settings: "tnum";
}

.walk-timer {
  font-size: 2.2rem;
  font-family: monospace;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.walk-instruction-card {
  background: var(--bg-surface-elevated);
  border-left: 4px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 20px 0;
  text-align: left;
}

.prompt-step-tag {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin-bottom: 6px;
}

.prompt-text {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--font-serif);
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-green);
}

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

/* Acoustic Spectrogram Canvas */
.spectrogram-container {
  background: #080d09;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
  position: relative;
}

#acousticCanvas {
  width: 100%;
  height: 90px;
  display: block;
}

.acoustic-badge-overlay {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--accent-green);
}

/* Offline Flora Scanner */
.scanner-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface-elevated);
  transition: all 0.2s ease;
}

.scanner-dropzone:hover {
  border-color: var(--accent-green);
  background: rgba(74, 222, 128, 0.04);
}

.dropzone-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

#previewImage {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-md);
  margin: 16px auto;
  display: none;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.specimen-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
}

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

.specimen-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-green);
}

/* Field Notebook / History */
.memory-entry {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease;
}

.memory-entry:hover {
  border-color: var(--border-focus);
}

.memory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.memory-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.memory-body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-family: var(--font-serif);
}

.memory-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.memory-tag {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
  animation: modalScale 0.2s ease;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

textarea {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  padding: 12px;
  font-size: 0.95rem;
  resize: vertical;
  margin: 12px 0;
}

textarea:focus {
  outline: none;
  border-color: var(--accent-green);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-green);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1001;
  animation: fadeIn 0.3s;
}
