/* NatureBuddy AI - Stylesheet
   Theme: Hacktoberfest 2026 Week 1 ("Touch Grass")
   Palette: Calm nature-inspired green & cream
*/

:root {
  /* Colors */
  --color-bg: #f8f6f0;
  --color-bg-card: #ffffff;
  --color-bg-subtle: #f1ede3;
  --color-bg-tint: #edf4ef;

  --color-forest: #234931;
  --color-forest-dark: #163221;
  --color-leaf: #3e6e4c;
  --color-leaf-light: #5f936d;
  --color-sage: #8aa993;
  --color-sage-soft: #dbe8df;

  --color-earth-cta: #d16b27;
  --color-earth-hover: #b85719;

  --color-text-main: #1c2921;
  --color-text-muted: #526357;
  --color-text-light: #76867b;

  --color-border: #e2ded4;
  --color-border-focus: #234931;

  --color-success-bg: #eaf6ed;
  --color-success-text: #1d6a36;
  --color-warning-bg: #fff7ed;
  --color-warning-border: #fed7aa;
  --color-warning-text: #9a3412;

  /* Typography & Sizing */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(35, 73, 49, 0.06), 0 1px 2px rgba(35, 73, 49, 0.04);
  --shadow-md: 0 4px 12px rgba(35, 73, 49, 0.08);
  --transition: 0.18s ease-in-out;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.app-header {
  background-color: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-tint);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-sage-soft);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-forest);
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-online { background-color: #22c55e; }
.status-offline { background-color: #f97316; }
.status-checking { background-color: #94a3b8; }

/* Main Layout */
.main-content {
  flex: 1;
  padding-top: 24px;
  padding-bottom: 48px;
}

/* Welcome Card */
.welcome-card {
  background: linear-gradient(135deg, #ffffff 0%, #f4ede1 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-sm);
}

.welcome-content {
  max-width: 650px;
}

.welcome-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background-color: var(--color-sage-soft);
  color: var(--color-forest);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.welcome-heading {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--color-forest-dark);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 10px;
}

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

.welcome-stats {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.stat-box {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  text-align: center;
  min-width: 105px;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-forest);
  line-height: 1.1;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* App Grid */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.grid-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards */
.card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #faf9f5;
  gap: 12px;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-forest);
  letter-spacing: -0.01em;
}

.card-subtitle {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.card-body {
  padding: 24px;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--color-bg-subtle);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.badge-success {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border-color: #bbf0c8;
}

.badge-accent {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.badge-gemma {
  background-color: var(--color-bg-tint);
  color: var(--color-forest);
  border-color: var(--color-sage-soft);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
  text-decoration: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-forest);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-forest);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--color-forest-dark);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--color-bg-subtle);
  color: var(--color-forest);
  border-color: var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
  background-color: #e6e0d2;
}
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline {
  background-color: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--color-bg-subtle);
  color: var(--color-text-main);
}
.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-danger-outline {
  background-color: transparent;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 0.78rem;
  padding: 4px 10px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.btn-danger-outline:hover {
  background-color: #fee2e2;
}

/* Feature A: Daily Quest */
.quest-display {
  display: flex;
  gap: 16px;
  background-color: var(--color-bg-tint);
  border: 1px solid var(--color-sage-soft);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.quest-emoji {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.quest-details {
  flex: 1;
}

.quest-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-forest);
  margin-bottom: 6px;
}

.quest-description {
  font-size: 0.95rem;
  color: var(--color-text-main);
  margin-bottom: 8px;
}

.quest-tip {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  background-color: rgba(255, 255, 255, 0.7);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-leaf);
}

.quest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.quest-footer {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-top: 1px dashed var(--color-border);
  padding-top: 12px;
}

/* Feature C: Screen-Free Challenge */
.challenge-prompt {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.timer-container {
  background-color: #faf9f5;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 20px;
}

.timer-digits {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--color-forest);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 14px;
}

.timer-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--color-bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.timer-progress-bar {
  height: 100%;
  background-color: var(--color-leaf);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.timer-status-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.timer-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.challenge-summary {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  border-top: 1px dashed var(--color-border);
  padding-top: 12px;
}

/* Feature B: AI Nature Guide */
.ai-prompt-description {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.alert-box {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning-text);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.alert-box code {
  background-color: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
}

.alert-hidden {
  display: none;
}

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

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.flex-1 {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-forest);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text-main);
  background-color: #faf9f6;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 48px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-forest);
  box-shadow: 0 0 0 3px rgba(35, 73, 49, 0.12);
  background-color: #ffffff;
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

.textarea-hint {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 4px;
}

.starter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chips-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.chip-btn {
  font-family: inherit;
  font-size: 0.78rem;
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-forest);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--transition);
  min-height: 32px;
}

.chip-btn:hover {
  background-color: var(--color-sage-soft);
}

.ai-form-actions {
  display: flex;
  gap: 10px;
}

/* AI Result Box */
.ai-result-card {
  margin-top: 20px;
  background-color: #fcfbf9;
  border: 1px solid var(--color-sage-soft);
  border-radius: var(--radius-md);
  padding: 18px;
}

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

.ai-result-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-forest);
}

.btn-text-copy {
  background: none;
  border: none;
  color: var(--color-forest);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.btn-text-copy:hover {
  background-color: var(--color-bg-subtle);
}

.ai-result-content {
  font-size: 0.93rem;
  color: var(--color-text-main);
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ai-result-content p {
  margin-bottom: 10px;
}

.ai-result-content ul, .ai-result-content ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

.ai-result-content li {
  margin-bottom: 4px;
}

.ai-disclaimer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.ai-loading {
  text-align: center;
  padding: 28px 20px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-sage-soft);
  border-top-color: var(--color-forest);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

.loading-text {
  font-size: 0.88rem;
  color: var(--color-forest);
  font-weight: 500;
}

/* Feature D: Nature Journal */
.journal-form {
  background-color: #faf9f5;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 24px;
}

.journal-form-actions {
  display: flex;
  justify-content: flex-end;
}

.journal-entries-section {
  border-top: 1px solid var(--color-border);
  padding-top: 18px;
}

.entries-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-forest);
  margin-bottom: 14px;
}

.journal-entries-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.journal-entry-card {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.journal-entry-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.journal-entry-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-entry-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: var(--color-bg-tint);
  color: var(--color-forest);
  border: 1px solid var(--color-sage-soft);
}

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

.journal-entry-location {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 6px;
}

.journal-entry-text {
  font-size: 0.92rem;
  color: var(--color-text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--color-text-muted);
  background-color: #faf9f6;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

/* Footer */
.app-footer {
  background-color: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  margin-top: auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.footer-title {
  color: var(--color-forest);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.footer-text code {
  background-color: var(--color-bg-subtle);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Responsive Styles */
@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .welcome-stats {
    width: 100%;
    justify-content: space-between;
  }

  .stat-box {
    flex: 1;
    min-width: 0;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-status {
    width: 100%;
    justify-content: center;
  }

  .welcome-heading {
    font-size: 1.45rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .welcome-stats {
    flex-direction: column;
    gap: 8px;
  }

  .timer-digits {
    font-size: 2.8rem;
  }

  .timer-actions, .quest-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .starter-chips {
    flex-direction: column;
    align-items: flex-start;
  }

  .chip-btn {
    width: 100%;
    text-align: left;
  }
}
