/* ============================================================
   Trail Conditions — Dashboard / index page
   Trail grid, trail card, all row variants, favorites,
   other-trails collapse, ride-window strip, drying-note,
   detail link, loading placeholder, unified trail list.
   ============================================================ */

/* ── Trail grid ──────────────────────────────────────────────── */
.trail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .trail-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Trail card ──────────────────────────────────────────────── */
.trail-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.trail-card.primary {
  border-width: 2px;
  border-color: var(--forest);
}

/* ── Card header ─────────────────────────────────────────────── */
.card-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  color: var(--forest);
}

.card-header .meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Status banner ───────────────────────────────────────────── */
.status-banner {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-open     { background: var(--green-lt);  color: var(--green); }
.status-caution  { background: var(--amber-lt);  color: var(--amber); }
.status-wet      { background: var(--orange-lt); color: var(--orange); }
.status-rain     { background: var(--blue-lt);   color: var(--blue); }
.status-loading  { background: #f0f0f0;           color: var(--muted); }

.dot-open     { background: var(--green); }
.dot-caution  { background: var(--amber); }
.dot-wet      { background: var(--orange); }
.dot-rain     { background: var(--blue); }
.dot-loading  { background: #ccc; }

/* ── Card body ───────────────────────────────────────────────── */
.card-body { padding: 0.75rem 1.25rem 1rem; }

/* ── Stat rows ───────────────────────────────────────────────── */
.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; }

.stat-label { color: var(--muted); }
.stat-value { font-weight: 500; color: var(--text); }

/* ── Rain bar mini-chart ─────────────────────────────────────── */
.rain-bar-wrap  { margin-top: 0.75rem; }

.rain-bar-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.rain-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
}

.rain-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  height: 100%;
  justify-content: flex-end;
}

.rain-bar-fill {
  width: 100%;
  border-radius: 2px 2px 0 0;
  transition: height 0.4s ease;
  min-height: 2px;
}

.rain-bar-day { font-size: 9px; color: var(--muted); }

/* ── Note box ────────────────────────────────────────────────── */
.note-box {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}

/* ── Forecast strip ──────────────────────────────────────────── */
.forecast-strip {
  display: flex;
  gap: 4px;
  margin-top: 0.75rem;
}

.fc-day {
  flex: 1;
  background: var(--dirt);
  border-radius: 6px;
  padding: 4px 2px;
  text-align: center;
}

.fc-day .fc-label { font-size: 9px;  color: var(--muted); }
.fc-day .fc-mm    { font-size: 11px; font-weight: 500; color: var(--text); }
.fc-day .fc-prob  { font-size: 9px;  color: var(--blue); }
.fc-day.has-rain  { background: var(--blue-lt); }

/* ── Misc ────────────────────────────────────────────────────── */
.coords {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

.error-state {
  padding: 1rem 1.25rem;
  font-size: 0.82rem;
  color: var(--red);
  background: #fef5f5;
}

/* ── Dashboard controls ──────────────────────────────────────── */
.all-trails-toggle { margin-bottom: 1.25rem; }

.all-trails-toggle button {
  background: var(--forest);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
}

.all-trails-toggle button:hover { opacity: 0.88; }

#all-trails { display: none; }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.25rem 0 0.6rem;
}
.section-label-loc {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 0.2rem;
}

.refresh-note {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1.25rem;
  text-align: center;
}

/* ── Ride window summary strip ───────────────────────────────── */
/* (Hero-card override lives in today.css alongside .hero-card) */
.ride-window-summary {
  padding: 0.55rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.ride-window-summary.good { background: var(--green-lt); color: #1a5c30; }
.ride-window-summary.warn { background: var(--amber-lt); color: #7a5000; }
.ride-window-summary.bad  { background: var(--blue-lt);  color: #0f4060; }

/* ── Drying conditions note ──────────────────────────────────── */
.drying-note {
  margin-top: 0.5rem;
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
}

.drying-note.warn { color: #7a5000; }
.drying-note.good { color: #1a5c30; }

/* ── Detail page link ────────────────────────────────────────── */
.detail-link-wrap {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.detail-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--forest);
  text-decoration: none;
}

.detail-link:hover { text-decoration: underline; }

/* ── Loading row placeholder ───────────────────────────── */
.row-loading {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  animation: pulse 1.5s infinite;
}

/* ── Primary trail rows (overview) ─────────────────────── */
.primary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.primary-row {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.75rem 1rem 0.75rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.12s;
}
.primary-row:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.09); }
.primary-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--s-color, #ccc);
}
.pr-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--forest);
  align-self: center;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.pr-dist {
  font-size: 0.73rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.pr-pill {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
  background: var(--s-bg, #eee);
  color: var(--s-color, #888);
}
.pr-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--s-color, #888);
}
.pr-meta {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  gap: 0.9rem;
}
.pr-meta span { white-space: nowrap; }

/* ── Secondary trail rows (overview) ───────────────────── */
.secondary-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.compact-row {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.12s;
  position: relative;
  overflow: hidden;
}
.compact-row:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.compact-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--s-color, #ccc);
}
.compact-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--s-color, #ccc);
}
.compact-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 600;
}
.compact-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--s-color, #888);
}
.compact-meta {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 70px;
  text-align: right;
}

/* ── Unified trail row (index page) ────────────────────── */
.trail-row {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0.7rem 1rem 0.7rem 1.25rem;
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.12s;
}
.trail-row:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.09); }
.trail-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--s-color, #ccc);
}
.row-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.row-name {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--forest);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-dist {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.row-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #bbb;
  padding: 0 0.15rem;
  flex-shrink: 0;
  transition: color 0.12s, transform 0.1s;
  position: relative;
  z-index: 1;
}
.row-star.fav { color: #e5a800; }
.row-star:hover { color: #e5a800; transform: scale(1.15); }
.row-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--s-bg, #eee);
  color: var(--s-color, #888);
}
.row-status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--s-color, #888);
}
.row-meta {
  display: flex;
  gap: 0.9rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.row-meta span { white-space: nowrap; }

/* ── Favorites section ───────────────────────────────────── */
.fav-divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0 0; }

/* ── Other-trails collapse toggle ───────────────────────── */
.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  touch-action: manipulation;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  text-align: left;
}
.section-toggle:hover { color: var(--forest); }
.toggle-chevron {
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.2s;
  display: inline-block;
}
.toggle-chevron.open { transform: rotate(180deg); }
.trail-list.other-collapsed { display: none; }

/* ── Trail list (unified, distance-sorted) ───────────────── */
.trail-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
