/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e8e8e8;
  -webkit-font-smoothing: antialiased;
}

/* === Layout === */
#app { height: 100%; display: flex; flex-direction: column; }
.view { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 80px; }
.hidden { display: none !important; }

/* === Header === */
.app-header {
  position: sticky; top: 0; z-index: 10;
  background: #1a1a2e; padding: 12px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.app-header h1 { font-size: 20px; font-weight: 600; }
.btn-back {
  background: none; border: none; color: #2d6a4f; font-size: 24px;
  cursor: pointer; padding: 4px 8px;
}

/* === Auth === */
.auth-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; text-align: center; gap: 16px;
}
.auth-logo { font-size: 80px; }
.auth-container h1 { font-size: 32px; color: #2d6a4f; }
.auth-tagline { color: #888; font-size: 16px; }

/* === Onboarding === */
.onboarding-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 100%; text-align: center; gap: 16px; padding: 24px;
}
.onboarding-container input {
  background: #16213e; border: 2px solid #2d6a4f; border-radius: 8px;
  color: #e8e8e8; font-size: 24px; text-align: center;
  padding: 12px; width: 160px; outline: none;
}
.region-preview { color: #888; font-size: 14px; min-height: 20px; }

/* === Buttons === */
.btn {
  padding: 12px 24px; border-radius: 8px; border: none;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: opacity 0.2s;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: #2d6a4f; color: white; }
.btn-secondary { background: #16213e; color: #2d6a4f; border: 1px solid #2d6a4f; }
.btn-danger { background: #dc3545; color: white; }
.btn-small { padding: 6px 12px; font-size: 13px; border-radius: 6px; background: #16213e; color: #2d6a4f; border: 1px solid #2d6a4f; }

/* === Filter Bar === */
.filter-bar { display: flex; gap: 8px; width: 100%; }
.filter-bar select {
  flex: 1; background: #16213e; color: #e8e8e8; border: 1px solid #333;
  border-radius: 6px; padding: 8px; font-size: 14px;
}

/* === Garden List === */
.garden-list { display: flex; flex-direction: column; gap: 12px; }
.garden-card {
  display: flex; gap: 12px; background: #16213e; border-radius: 12px;
  padding: 12px; cursor: pointer; transition: background 0.2s;
}
.garden-card:active { background: #1f2b47; }
.garden-card img {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.garden-card-info { flex: 1; min-width: 0; }
.garden-card-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.garden-card-info p { font-size: 13px; color: #888; }

/* === Native Badge === */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-native { background: #2d6a4f; color: white; }
.badge-non-native { background: #dc3545; color: white; }
.badge-unknown { background: #f0ad4e; color: #333; }

/* === ID Card === */
.id-card {
  background: #16213e; border-radius: 16px; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.id-card img { width: 100%; border-radius: 12px; max-height: 300px; object-fit: cover; }
.id-card h2 { font-size: 22px; }
.id-card .scientific { color: #888; font-style: italic; font-size: 14px; }
.id-card .confidence { color: #2d6a4f; font-size: 14px; font-weight: 600; }

.characteristics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.char-item { background: #1a1a2e; border-radius: 8px; padding: 10px; }
.char-label { font-size: 11px; color: #888; text-transform: uppercase; margin-bottom: 4px; }
.char-value { font-size: 14px; font-weight: 500; }

.id-actions { display: flex; gap: 8px; }
.id-actions .btn { flex: 1; text-align: center; }

/* === Plant Detail === */
.plant-detail { display: flex; flex-direction: column; gap: 16px; }
.photo-timeline { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.photo-timeline img {
  width: 80px; height: 80px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.note-item {
  background: #16213e; border-radius: 8px; padding: 12px;
}
.note-item .note-date { font-size: 11px; color: #888; margin-bottom: 4px; }
.note-item .note-text { font-size: 14px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === Map === */
.map-container { height: calc(100vh - 140px); border-radius: 12px; overflow: hidden; }

/* === Settings === */
.settings-list { display: flex; flex-direction: column; gap: 20px; }
.settings-group h3 { font-size: 14px; color: #2d6a4f; text-transform: uppercase; margin-bottom: 8px; }
.settings-item { background: #16213e; border-radius: 8px; padding: 12px; font-size: 14px; }
.toggle-label {
  display: flex; justify-content: space-between; align-items: center;
  background: #16213e; border-radius: 8px; padding: 12px;
}
.settings-version { text-align: center; color: #555; font-size: 13px; }

/* === Empty State === */
.empty-state { text-align: center; padding: 40px 20px; color: #888; }
.empty-state p { margin-bottom: 8px; }

/* === Loading === */
.loading { text-align: center; padding: 60px 20px; }
.spinner {
  width: 40px; height: 40px; border: 3px solid #333; border-top-color: #2d6a4f;
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Error === */
.error-state {
  text-align: center; padding: 40px 20px; color: #dc3545;
}

/* === Bottom Nav === */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: center;
  background: #16213e; border-top: 1px solid #333;
  padding: 8px 0; padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; color: #888; cursor: pointer;
  padding: 4px 12px; gap: 2px; transition: color 0.2s;
}
.nav-btn.active { color: #2d6a4f; }
.nav-icon { font-size: 24px; }
.nav-label { font-size: 10px; }
.nav-identify {
  background: #2d6a4f; border-radius: 50%; width: 56px; height: 56px;
  margin-top: -20px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: white;
}
.nav-identify .nav-label { color: white; }

/* === Modal === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-content {
  background: #16213e; border-radius: 16px; padding: 24px;
  width: 100%; max-width: 400px; max-height: 80vh; overflow-y: auto;
}
.modal-content h3 { font-size: 18px; margin-bottom: 16px; }
.modal-content input, .modal-content textarea, .modal-content select {
  width: 100%; background: #1a1a2e; border: 1px solid #333;
  border-radius: 8px; color: #e8e8e8; padding: 10px; font-size: 14px;
  margin-bottom: 12px; outline: none; font-family: inherit;
}
.modal-content textarea { resize: vertical; min-height: 80px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* === Share Page === */
.share-page {
  max-width: 500px; margin: 0 auto; text-align: center;
}
.share-page .cta {
  margin-top: 24px; padding: 16px; background: #16213e;
  border-radius: 12px; font-size: 14px; color: #2d6a4f;
}

/* === Alerts === */
.alerts-list { display: flex; flex-direction: column; gap: 12px; }
.alert-card {
  background: #16213e; border-radius: 12px; padding: 16px;
  border-left: 4px solid #2d6a4f;
}
.alert-card h3 { font-size: 16px; margin-bottom: 4px; }
.alert-card p { font-size: 14px; color: #ccc; }

/* === PWA Install Banner === */
.install-banner {
  position: fixed; bottom: 70px; left: 16px; right: 16px;
  background: #2d6a4f; border-radius: 12px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 150; font-size: 14px;
}
.install-banner button { background: white; color: #2d6a4f; border: none; border-radius: 6px; padding: 6px 12px; font-weight: 600; }
.install-dismiss { background: none !important; color: white !important; font-size: 18px; }
