/* =============================================
   GRATITUDE GARDEN — Styles
   ============================================= */

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

:root {
  --cream:       #FAF6EE;
  --parchment:   #F2EBD9;
  --bark:        #8B6F52;
  --soil:        #3D2B1F;
  --soil-light:  #5C3D2E;
  --grass:       #2E5E2E;
  --grass-light: #4A8C4A;
  --sage:        #7A9E7E;
  --ink:         #2C2018;
  --ink-soft:    #5A4A3A;
  --gold:        #C8922A;
  --terracotta:  #C4704F;
}

body {
  font-family: 'Lora', serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}

/* ── Loading screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 1rem;
}

.loading-screen p {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #D9CDB8;
  border-top-color: var(--grass);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Status bar ── */
.status-bar {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  display: none;
}

.status-bar.online  { background: #E8F5E8; color: #2E5E2E; display: block; }
.status-bar.error   { background: #FDECEA; color: #C62828; display: block; }

/* ── Header ── */
.header {
  text-align: center;
  padding: 2.5rem 1rem 1.2rem;
}

.header::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 1rem auto 0;
  border-radius: 2px;
}

.header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 600;
  color: var(--soil);
}

.header p {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--soil);
  color: var(--parchment);
  font-size: 0.78rem;
  padding: 4px 14px;
  border-radius: 20px;
  margin-top: 0.8rem;
}

/* ── Journal section ── */
.journal-section {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 1.2rem 2rem;
}

.entry-card {
  background: var(--parchment);
  border-radius: 16px;
  padding: 1.8rem;
  border: 1px solid #D9CDB8;
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--grass), var(--gold), var(--terracotta));
  border-radius: 16px 16px 0 0;
}

.date-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--bark);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.entry-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--soil);
  margin-bottom: 1rem;
  font-weight: 400;
  font-style: italic;
}

textarea {
  width: 100%;
  min-height: 100px;
  background: rgba(255,255,255,0.6);
  border: 1px solid #C8BBA8;
  border-radius: 10px;
  padding: 0.9rem;
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.7;
}

textarea::placeholder { color: #B0A090; font-style: italic; }

textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(122,158,126,0.18);
}

.plant-btn {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.82rem;
  background: var(--grass);
  color: #E8F5E8;
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.plant-btn:hover    { background: var(--grass-light); }
.plant-btn:active   { transform: scale(0.98); }
.plant-btn:disabled { background: #9BB89B; cursor: default; }

.saving-msg {
  text-align: center;
  margin-top: 0.8rem;
  color: var(--bark);
  font-style: italic;
  font-size: 0.85rem;
}

.success-msg {
  text-align: center;
  margin-top: 0.8rem;
  color: #4A8C4A;
  font-style: italic;
  font-size: 0.85rem;
}

.already-planted { text-align: center; padding: 1rem 0 0.5rem; }
.already-planted .icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.already-planted p { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; }

.user-info {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.logout-btn {
  background: none;
  border: 1px solid #C8BBA8;
  border-radius: 20px;
  padding: 3px 12px;
  font-family: 'Lora', serif;
  font-size: 0.75rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.logout-btn:hover {
  background: var(--parchment);
  color: var(--ink);
}

.today-count {
  font-size: 0.82rem;
  color: var(--grass);
  margin-bottom: 0.8rem;
  font-style: italic;
}

.entry-preview {
  margin-top: 0.8rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255,255,255,0.5);
  border-radius: 8px;
  border-left: 3px solid var(--sage);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ── Garden section ── */
.garden-section {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.2rem 3rem;
}

.garden-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--soil);
  text-align: center;
  margin-bottom: 0.5rem;
  font-weight: 400;
  font-style: italic;
}

.garden-counter {
  text-align: center;
  font-size: 0.78rem;
  color: var(--bark);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.garden-frame {
  background: var(--grass);
  border-radius: 20px;
  overflow: hidden;
  min-height: 260px;
  box-shadow: 0 8px 28px rgba(46,94,46,0.22);
}

/* Sky */
.sky {
  height: 75px;
  background: linear-gradient(180deg, #B8D8E8 0%, #D4EAD4 100%);
  position: relative;
}

.sun {
  position: absolute;
  top: 13px; right: 38px;
  width: 32px; height: 32px;
  background: #F5C842;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(245,200,66,0.5);
}

.cloud {
  position: absolute;
  background: rgba(255,255,255,0.85);
  border-radius: 20px;
}
.cloud1 { top: 18px; left: 28px; width: 56px; height: 17px; }
.cloud1::before {
  content: '';
  position: absolute;
  top: -10px; left: 11px;
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.85);
  border-radius: 50%;
}
.cloud2 { top: 28px; left: 120px; width: 42px; height: 13px; }
.cloud2::before {
  content: '';
  position: absolute;
  top: -8px; left: 8px;
  width: 20px; height: 20px;
  background: rgba(255,255,255,0.85);
  border-radius: 50%;
}

/* Soil */
.soil-strip {
  background: var(--soil);
  height: 18px;
  position: relative;
}
.soil-strip::before {
  content: '';
  position: absolute;
  top: -5px; left: 0; right: 0;
  height: 9px;
  background: var(--soil-light);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

/* Garden floor */
.garden-floor {
  background: var(--soil);
  min-height: 170px;
  padding: 10px 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 7px 4px;
}

.empty-msg {
  width: 100%;
  text-align: center;
  padding: 2rem 0;
  color: rgba(255,255,255,0.3);
  font-style: italic;
  font-size: 0.82rem;
}

.hint {
  text-align: center;
  font-size: 0.72rem;
  color: #A09080;
  margin-top: 0.6rem;
  font-style: italic;
}

/* ── Plants ── */
.plant-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: growUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  cursor: pointer;
  position: relative;
}

.plant-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--soil);
  color: var(--parchment);
  font-family: 'Lora', serif;
  font-size: 0.7rem;
  padding: 6px 9px;
  border-radius: 7px;
  white-space: normal;
  max-width: 170px;
  text-align: center;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 10;
}

.plant-tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--soil);
}

.plant-wrapper:hover .plant-tooltip { opacity: 1; }

.tip-date {
  font-size: 0.6rem;
  opacity: 0.65;
  display: block;
  margin-top: 2px;
}

@keyframes growUp {
  from { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
  to   { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
}

/* ── Past entries ── */
.entries-section {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 1.2rem 4rem;
}

.entries-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--soil);
  margin-bottom: 1rem;
  font-weight: 400;
  font-style: italic;
  text-align: center;
}

.entry-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.9rem 0;
  border-bottom: 1px dashed #D9CDB8;
}
.entry-item:last-child { border-bottom: none; }

.entry-item-date {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--bark);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.entry-item-text {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
  font-style: italic;
}