/* ==========================================================================
   Mouse Ears & Strollers — planner-specific styles
   ========================================================================== */

.planner-shell { padding: 8px 0 60px; }

/* ---------------- Meals & snacks controls ---------------- */
.meals-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0;
}
.meals-fieldset legend {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-700);
  padding: 0 6px;
}
.meal-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.meal-row:last-child { border-bottom: none; }
.meal-row .checkbox { flex: 0 0 auto; min-width: 130px; }
.meal-time { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meal-time label { font-size: 0.82rem; color: var(--ink-500); }
.meal-time input[type="time"] { width: auto; }
.meal-row select { width: auto; }
.meal-hint { font-size: 0.78rem; color: var(--ink-500); font-style: italic; }
@media (max-width: 640px) {
  .meal-row .checkbox { min-width: 0; }
}

/* ---------------- Step tabs ---------------- */
.step-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}
.step-tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-700);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.step-tab .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 0.72rem;
  font-weight: 800;
}
.step-tab.is-active {
  background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
  color: var(--white);
  border-color: transparent;
}
.step-tab.is-active .step-num { background: rgba(255,255,255,0.25); color: var(--white); }

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

.step-panel { display: none; }
.step-panel.is-active { display: block; animation: fadeIn 0.18s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Form ---------------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }

label { font-size: 0.86rem; font-weight: 600; color: var(--ink-700); }

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--ink-900);
  width: 100%;
}
textarea { resize: vertical; min-height: 44px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--pink-500);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--pink-100);
}

.toggles { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--ink-700);
  cursor: pointer;
}
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--pink-500); flex: none; }

/* ---------------- Sidebar cards ---------------- */
.planner-sidebar { display: flex; flex-direction: column; gap: 16px; }
.sidebar-card { padding: 0; overflow: hidden; }
.sidebar-card-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 18px 20px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.sidebar-card-head h3 { margin: 0; font-size: 1rem; }
.chevron { width: 18px; height: 18px; color: var(--ink-500); transition: transform 0.15s ease; flex: none; }
.sidebar-card-body { padding: 0 20px 20px; }

/* Desktop: sidebar cards are always expanded — only collapsible on mobile */
.sidebar-card-head { pointer-events: none; }
.chevron { display: none; }

/* ---------------- Freshness card ---------------- */
.freshness-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.88rem;
}
.freshness-row:last-child { border-bottom: none; padding-bottom: 0; }
.freshness-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
}
.freshness-badge.fresh { background: #e8f8ef; color: #1f7a4c; }
.freshness-badge.stale { background: #fdf3e0; color: #97690e; }
.freshness-badge.offline, .freshness-badge.unknown { background: #fbe9e7; color: #a63c33; }
.freshness-note { font-size: 0.82rem; color: var(--ink-500); margin-top: 10px; }
.freshness-warning {
  display: block;
  margin-top: 10px;
  background: #fbe9e7;
  color: #a63c33;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------------- Plan summary ---------------- */
.summary-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.summary-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; }
.summary-list .k { color: var(--ink-500); }
.summary-list .v { font-weight: 700; text-align: right; }

.confidence-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
}
.confidence-tag.low { background: #fdf3e0; color: #97690e; }
.confidence-tag.medium { background: var(--blue-100); color: var(--blue-700); }
.confidence-tag.high { background: #e8f8ef; color: #1f7a4c; }

.historical-note {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--ink-500);
  font-style: italic;
}

/* ---------------- Crowd forecast ---------------- */
.crowd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.crowd-row { font-size: 0.88rem; }
.crowd-row-top { display: flex; justify-content: space-between; margin-bottom: 5px; }
.crowd-row-top .name { font-weight: 600; }
.crowd-bar { height: 7px; border-radius: 999px; background: var(--border); overflow: hidden; }
.crowd-bar-fill { height: 100%; border-radius: 999px; background: var(--blue-500); }
.crowd-bar-fill.low { background: var(--ok); }
.crowd-bar-fill.moderate { background: var(--blue-500); }
.crowd-bar-fill.high, .crowd-bar-fill.very-high { background: var(--bad); }

/* ---------------- Tips ---------------- */
.tips-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 0.88rem; color: var(--ink-700); }

/* ---------------- Itinerary ---------------- */
.itinerary-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.itinerary-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}
.itinerary-item.is-break { background: var(--blue-100); border-color: transparent; }
.itinerary-item.is-warning { background: #fff7ea; }
.itinerary-time { flex: none; width: 78px; font-weight: 700; color: var(--pink-600); font-size: 0.9rem; }
.itinerary-body h4 { margin: 0 0 4px; font-size: 0.98rem; }
.itinerary-meta { font-size: 0.82rem; color: var(--ink-500); margin-bottom: 6px; }
.itinerary-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.item-reason { margin: 8px 0 0; font-size: 0.82rem; color: var(--ink-500); font-style: italic; }

.plan-type-banner {
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  background: var(--blue-100);
  color: var(--blue-700);
}
.plan-type-banner.is-fresh { background: #e8f8ef; color: #1f7a4c; }
.plan-type-banner.is-stale { background: #fdf3e0; color: #97690e; }
.plan-type-banner strong { font-weight: 800; }
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--ink-700);
}
.badge.pink { background: var(--pink-100); color: var(--pink-600); border-color: transparent; }
.badge.blue { background: var(--blue-100); color: var(--blue-700); border-color: transparent; }

.avoid-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: #fbe9e7;
  color: #8a3a32;
  font-size: 0.88rem;
}
.avoid-box h4 { margin: 0 0 6px; color: #8a3a32; font-size: 0.92rem; }
.avoid-box ul { margin: 0; padding-left: 18px; }

/* ---------------- Route / map step ---------------- */
.route-steps { list-style: none; margin: 0; padding: 0; position: relative; }
.route-steps li {
  position: relative;
  padding: 0 0 22px 34px;
  border-left: 2px dashed var(--border);
  margin-left: 12px;
}
.route-steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.route-pin {
  position: absolute;
  left: -13px;
  top: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pink-500);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.route-steps .route-name { font-weight: 700; }
.route-steps .route-meta { font-size: 0.82rem; color: var(--ink-500); }

/* ---------------- Live optimise ---------------- */
.optimise-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 0.88rem; }
.optimise-table th, .optimise-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.optimise-table th { color: var(--ink-500); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
.delta-up { color: var(--bad); font-weight: 700; }
.delta-down { color: var(--ok); font-weight: 700; }
.delta-flat { color: var(--ink-500); }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .planner-grid { grid-template-columns: 1fr; }
  .planner-sidebar { order: 2; }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .step-tab span:not(.step-num) { display: none; }
  .step-tab { flex: 0 0 auto; padding: 10px 12px; }

  /* Collapsible sidebar cards on mobile */
  .sidebar-card-head { pointer-events: auto; }
  .chevron { display: block; }
  .sidebar-card-body { display: none; }
  .sidebar-card.is-open .sidebar-card-body { display: block; }
  .sidebar-card.is-open .chevron { transform: rotate(180deg); }

  .itinerary-item { flex-direction: column; gap: 4px; }
  .itinerary-time { width: auto; }
  .btn-block { font-size: 1rem; }
}
