/* Design tokens shared by the whole PWA. */
:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #eef6f4;
  --text: #111827;
  --muted: #64748b;
  --line: #d7dee8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

/* Global sizing and base typography. */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background: #e9edf4;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

/* Main phone-sized shell that centers on desktop and fills the mobile viewport. */
.app-shell {
  width: min(100%, 480px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header and screen tabs provide app state plus navigation between views. */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
}

.brand,
.status-pill,
.kicker,
.footer-note p {
  margin: 0;
}

.brand {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill {
  min-width: 78px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.screen-nav {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: rgba(255, 255, 255, 0.75);
}

.screen-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.screen-tab.is-active {
  background: var(--text);
  color: #ffffff;
}

/* Horizontal screen track keeps Checklist and Weather as swipeable full-width
views while hiding the native scrollbar. */
.screen-track {
  width: 100%;
  margin: 0;
  padding: 0 0 8px;
  display: flex;
  gap: 0;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.screen-track::-webkit-scrollbar {
  display: none;
}

.app-screen {
  width: 100%;
  min-width: 100%;
  flex: 0 0 100%;
  scroll-snap-align: start;
}

/* Checklist card layout, app icon, heading, completion mark, and helper copy. */
.recommendation-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 20px 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.app-icon {
  width: 70px;
  height: 70px;
  display: block;
  margin-bottom: 22px;
  margin-left: 0;
  margin-right: 0;
}

.kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.checklist-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.recommendation-title {
  min-height: 0;
  margin: 8px 0 10px;
  color: var(--text);
  font-size: clamp(2.15rem, 10.5vw, 2.95rem);
  line-height: 1.02;
  letter-spacing: 0;
  text-align: left;
}

.completion-mark {
  width: 58px;
  height: 58px;
  margin-top: 2px;
  border: 2px solid rgba(15, 118, 110, 0.25);
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: scale(0.82);
  transition: opacity 160ms ease, transform 160ms ease;
}

.is-complete .completion-mark {
  opacity: 1;
  transform: scale(1);
}

.reason {
  min-height: 0;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.45;
  text-align: left;
}

/* Checklist rows use real checkboxes for accessibility while styling a custom
checkmark box beside each item. */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.item-list:empty {
  display: none;
}

.item-list li {
  min-height: 56px;
}

.checklist-row {
  position: relative;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.checklist-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.checkbox-mark {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(15, 118, 110, 0.35);
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--surface-strong);
  color: transparent;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.checklist-row input:checked + .checkbox-mark {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.checklist-row input:focus-visible + .checkbox-mark {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 3px;
}

.checklist-label {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 800;
}

.empty-checklist {
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 800;
  text-align: left;
}

/* Checklist-specific alignment keeps the card content left-aligned inside the
centered screen. */
#checklistScreen {
  display: block;
  text-align: left;
}

#checklistScreen .app-icon {
  margin-left: 0;
  margin-right: auto;
}

#checklistScreen .kicker,
#checklistScreen .recommendation-title,
#checklistScreen .reason {
  display: block;
  width: 100%;
  text-align: left;
}

#checklistScreen .checklist-heading {
  width: 100%;
  justify-content: space-between;
  text-align: left;
}

/* Primary location action and Settings controls. */
.primary-action {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--text);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.primary-action:active {
  transform: translateY(1px);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.settings-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: rgba(245, 247, 251, 0.8);
}

.settings-panel summary {
  min-height: 46px;
  padding: 13px 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.routine-start-setting {
  border-top: 1px solid var(--line);
  padding: 14px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.routine-start-setting span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.routine-start-setting strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
  white-space: nowrap;
}

.routine-start-slider {
  width: calc(100% - 28px);
  margin: 0 14px 16px;
  accent-color: var(--accent);
}

/* Notification settings explain reminder status and expose enable/test actions. */
.notification-setting {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.setting-copy span {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 850;
}

.setting-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.35;
}

.notification-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-action {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-action:not(:disabled):active {
  transform: translateY(1px);
}

/* Weather details screen presents the current temperature and forecast facts. */
.weather-screen {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-align: center;
}

.weather-hero {
  padding: 34px 22px 28px;
}

.temperature-title {
  margin: 12px 0 28px;
  color: var(--text);
  font-size: clamp(5.4rem, 30vw, 7.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.temperature-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.temperature-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 14px;
  background: var(--bg);
}

.temperature-summary span,
.weather-detail-section span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.temperature-summary strong,
.weather-detail-section strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 850;
}

.weather-detail-list {
  border-top: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}

.weather-detail-section {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
}

.weather-detail-section:last-child {
  border-bottom: 1px solid var(--line);
}

/* Footer and state styling for error or warning conditions. */
.footer-note {
  margin-top: auto;
  padding: 0 2px;
}

.footer-note p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.is-error .status-pill {
  border-color: rgba(185, 28, 28, 0.22);
  background: #fef2f2;
  color: var(--danger);
}

.is-warning .status-pill {
  border-color: rgba(180, 83, 9, 0.22);
  background: #fffbeb;
  color: var(--warning);
}

/* Lightweight refresh prompt appears when the service worker has installed an
updated app version. */
.update-banner {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  z-index: 20;
  max-width: 448px;
  margin: 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 10px 10px 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.update-banner[hidden] {
  display: none;
}

.update-banner button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  background: var(--text);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 850;
  cursor: pointer;
}

/* Desktop viewport treatment keeps the mobile app form factor centered. */
@media (min-width: 720px) {
  body {
    display: grid;
    place-items: center;
    padding: 28px;
  }

  .app-shell {
    min-height: min(860px, calc(100svh - 56px));
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 28px;
  }
}
