/* =============================================================
   The Potting Shed — app.css
   Mobile-first. No framework dependencies.
   ============================================================= */

/* --- Custom properties ------------------------------------ */
:root {
  --green-900: #1b4332;
  --green-700: #2d6a4f;
  --green-500: #52b788;
  --green-300: #95d5b2;
  --green-100: #d8f3dc;
  --green-50:  #f0faf3;

  --cream:     #f2f5f0;
  --surface:   #ffffff;
  --border:    #d3e0d6;
  --border-md: #b7cebe;

  --text:      #1b2e24;
  --text-mid:  #3d5a47;
  --text-muted:#52796f;

  --error-bg:  #fde8e8;
  --error-text:#7c2020;
  --error-border:#e63946;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 3px 14px rgba(0,0,0,0.09);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.11);

  --nav-h: 54px;
  --font:  "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, monospace;
}

/* --- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: var(--green-700); }
a:hover { color: var(--green-900); }

/* --- Navigation ------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--green-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  min-height: var(--nav-h);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.nav__brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.nav__brand:hover { color: var(--green-300); text-decoration: none; }
.nav__brand-icon { font-size: 1.3rem; line-height: 1; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav__link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav__link:hover,
.nav__link--active {
  color: #fff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

.nav__logout-form { display: inline; margin: 0; }
.nav__logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.nav__logout:hover { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.5); }

/* --- Page wrapper ----------------------------------------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.page--xs  { max-width: 460px; }
.page--sm  { max-width: 600px; }
.page--md  { max-width: 780px; }

/* --- Cards ------------------------------------------------ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

/* --- Alerts ----------------------------------------------- */
.alert {
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  border-left: 4px solid;
  margin-bottom: 1.1rem;
}
.alert--error   { background: var(--error-bg);  color: var(--error-text);  border-color: var(--error-border); }
.alert--success { background: var(--green-100); color: var(--green-900);   border-color: var(--green-500); }
.alert--info    { background: #e8f4fd; color: #174d73; border-color: #5ba3c9; }

/* --- Forms ------------------------------------------------ */
.form-group { margin-top: 1.15rem; }
.form-group:first-child { margin-top: 0; }

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.form-input,
.form-select {
  display: block;
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2352796f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.22);
}
.form-input:disabled {
  background: var(--cream);
  color: var(--text-muted);
  cursor: not-allowed;
  border-color: var(--border);
}

/* --- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.35rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover  { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); box-shadow: none; }

.btn--primary { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.btn--primary:hover { background: var(--green-900); border-color: var(--green-900); color: #fff; }

.btn--secondary { background: var(--surface); color: var(--text-mid); border-color: var(--border-md); }
.btn--secondary:hover { background: var(--cream); border-color: var(--green-500); color: var(--text); }

.btn--ghost { background: transparent; color: var(--text-mid); border-color: transparent; }
.btn--ghost:hover { background: var(--cream); color: var(--text); }

.btn--danger { background: var(--error-bg); color: var(--error-text); border-color: #f5a5a5; }
.btn--danger:hover { background: #fca5a5; border-color: var(--error-border); }

.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.btn--full { width: 100%; }

/* --- Section header --------------------------------------- */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.section-header h1 { font-size: 1.55rem; line-height: 1.2; }
.section-header p  { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.2rem; }

/* --- Feature grid (home dashboard) ----------------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.feature-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.25rem;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text);
  border: 2px solid transparent;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.feature-tile:hover {
  border-color: var(--green-500);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: var(--text);
}
.feature-tile__icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}
.feature-tile__title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: var(--green-900);
}
.feature-tile__desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}

/* --- Task list -------------------------------------------- */
.task-list { list-style: none; }

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.task-item:first-child { border-top: 1px solid var(--border); }
.task-item--done .task-item__title { text-decoration: line-through; color: var(--text-muted); }
.task-item--overdue .task-item__due { color: var(--error-text); font-weight: 600; }

.task-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.badge--sow_indoors  { background: #3b9ec9; }
.badge--sow_outdoors { background: #6aaa27; }
.badge--transplant   { background: #e0922a; }
.badge--harvest      { background: #d95f5f; }
.badge--general      { background: var(--text-muted); }

.task-item__body  { flex: 1; min-width: 0; }
.task-item__title { font-weight: 600; font-size: 0.95rem; }
.task-item__meta  { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }

.task-item__actions { display: flex; gap: 0.3rem; flex-shrink: 0; align-items: flex-start; margin-top: 0.1rem; }
.task-item__actions form { display: inline; }

.task-progress { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 60px; max-width: 140px; }
.progress-bar__fill { height: 100%; background: var(--green-700); border-radius: 3px; transition: width 0.2s; }
.progress-form { display: flex; }
.progress-select { font-size: 0.78rem; padding: 0.1rem 0.3rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; }

/* --- Empty state ------------------------------------------ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state__title { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }

/* --- Pill tabs / filter bar ------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

/* --- Two-column grid -------------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* --- Utility ---------------------------------------------- */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.gap-1 { gap: 0.5rem; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 0.88rem; }
.text-center  { text-align: center; }
.d-flex       { display: flex; }
.flex-wrap    { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* --- Sign-in page ----------------------------------------- */
.signin-wrap {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.signin-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
}
.signin-card__logo {
  text-align: center;
  font-size: 3rem;
  margin-bottom: 0.5rem;
}
.signin-card__title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-900);
  margin-bottom: 0.3rem;
}
.signin-card__sub {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* --- Gardens -------------------------------------------- */
.garden-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.garden-tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text);
  border: 2px solid transparent;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.garden-tile:hover {
  border-color: var(--green-500);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: var(--text);
}
.garden-tile__name     { font-weight: 700; font-size: 1rem; color: var(--green-900); }
.garden-tile__location { font-size: 0.84rem; color: var(--text-muted); }
.garden-tile__meta     { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }

/* --- Year navigation ------------------------------------- */
.year-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.year-nav__current {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-900);
  min-width: 4rem;
  text-align: center;
}

/* --- Bed cards ------------------------------------------- */
.bed-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.bed-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.bed-card__name { font-weight: 700; font-size: 1rem; color: var(--green-900); }
.bed-card__dims { display: block; font-size: 0.82rem; margin-top: 0.1rem; }

/* --- Planting table -------------------------------------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.planting-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.planting-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.4rem 0.5rem;
  border-bottom: 1.5px solid var(--border);
}
.planting-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.planting-table tbody tr:last-child td { border-bottom: none; }
.planting-table form { display: inline; }

.family-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 500;
}

.rotation-warning { cursor: help; }
.rotation-warning-text {
  font-size: 0.82rem;
  color: #92400e;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a !important;
  padding: 0.4rem 0.75rem !important;
}

/* --- Collapsible add-forms ------------------------------- */
.detail-form {
  border: 1.5px dashed var(--border-md);
  border-radius: var(--radius-md);
}
.detail-form > summary {
  cursor: pointer;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green-700);
  list-style: none;
  user-select: none;
}
.detail-form > summary::-webkit-details-marker { display: none; }
.detail-form[open] > summary { border-bottom: 1.5px dashed var(--border-md); }
.detail-form__body { padding: 0.9rem; }

/* --- Diary feed ------------------------------------------ */
.diary-feed { display: flex; flex-direction: column; gap: 0.75rem; }

.diary-entry {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.diary-entry__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.diary-entry__content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}
.diary-entry__footer {
  margin-top: 0.65rem;
  font-size: 0.85rem;
}
.diary-entry__footer a { color: var(--green-700); }

.visibility-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #e0f2fe;
  color: #075985;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.visibility-tag--friends {
  background: #d1fae5;
  color: #065f46;
}
.visibility-tag--private {
  background: #f3f4f6;
  color: #6b7280;
}

/* --- Social feed ----------------------------------------- */
.feed-feed { display: flex; flex-direction: column; gap: 0.75rem; }

.feed-entry {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid var(--border);
}
.feed-entry__header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.65rem; }
.feed-entry__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; flex-shrink: 0;
}
.feed-entry__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; font-size: 0.88rem; }
.feed-entry__meta a { color: var(--text); font-weight: 600; text-decoration: none; }
.feed-entry__meta a:hover { text-decoration: underline; }
.feed-entry__content { font-size: 0.95rem; line-height: 1.6; white-space: pre-wrap; }
.feed-entry__footer { display: flex; align-items: center; gap: 1rem; margin-top: 0.65rem; }

/* Kudos */
.kudos-container { display: flex; align-items: center; gap: 0.35rem; }
.kudos-btn {
  background: none; border: 1.5px solid var(--border); border-radius: 6px;
  padding: 0.2rem 0.5rem; cursor: pointer; font-size: 1rem; line-height: 1;
  transition: border-color 0.15s, background 0.15s;
}
.kudos-btn:hover { border-color: var(--green-700); background: var(--cream); }
.kudos-btn--active { background: #f0fdf4; border-color: var(--green-700); }
.kudos-count { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); min-width: 1ch; }

/* People grid */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.people-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.1rem;
  display: flex; align-items: center; gap: 0.85rem;
}
.people-card__avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; flex-shrink: 0;
}
.people-card__body { flex: 1; min-width: 0; }
.people-card__body strong a { color: var(--text); text-decoration: none; }
.people-card__body strong a:hover { text-decoration: underline; }
.people-card__action { flex-shrink: 0; }

/* Profile hero */
.profile-hero__top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.profile-hero__avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; flex-shrink: 0;
}

/* --- Comments -------------------------------------------- */
.comment-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.5rem; }

.comment-item {
  background: var(--cream);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.9rem;
}
.comment-item__meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
}
.comment-item__body { font-size: 0.9rem; line-height: 1.5; }

/* --- Checkbox label -------------------------------------- */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  accent-color: var(--green-700);
}

/* --- Card section title ---------------------------------- */
.card-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-900);
  margin-bottom: 0.85rem;
}

/* --- Debug link ------------------------------------------- */
.debug-link {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fffbe6;
  border: 1px solid #f6d860;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 520px) {
  .page { padding: 1rem 0.75rem 2.5rem; }
  .card { padding: 1.15rem; border-radius: var(--radius-md); }
  .signin-card { padding: 1.5rem; }
  .section-header h1 { font-size: 1.3rem; }
  .nav { padding: 0 0.75rem; }
  .nav__link { padding: 0.35rem 0.5rem; font-size: 0.85rem; }
  .nav__logout { padding: 0.3rem 0.55rem; font-size: 0.85rem; }
}
