/* Tourwatch — styled after iOS Calendar, Reminders and Music. */
:root {
  --bg: #f2f2f7;            /* grouped background */
  --bg-plain: #ffffff;      /* calendar background */
  --card: #ffffff;
  --label: #000000;
  --secondary: rgba(60, 60, 67, .6);
  --tertiary: rgba(60, 60, 67, .3);
  --separator: rgba(60, 60, 67, .2);
  --fill: rgba(120, 120, 128, .12);
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --glass: rgba(255, 255, 255, .72);
  --glass-border: rgba(255, 255, 255, .9);
  --glass-shadow: 0 6px 24px rgba(0, 0, 0, .1), 0 1px 2px rgba(0, 0, 0, .06);
  --tab-active: rgba(120, 120, 128, .14);
  --scrim: rgba(0, 0, 0, .25);
  --edge-shade: rgba(0, 0, 0, .14);   /* darkening behind the tab bar */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
/* Dark: follows the device, unless forced with data-theme (the preview page's Light/Dark switch). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-plain: #000000;
    --card: #1c1c1e;
    --label: #ffffff;
    --secondary: rgba(235, 235, 245, .6);
    --tertiary: rgba(235, 235, 245, .3);
    --separator: rgba(84, 84, 88, .6);
    --fill: rgba(120, 120, 128, .24);
    --blue: #0a84ff;
    --red: #ff453a;
    --green: #30d158;
    --glass: rgba(44, 44, 46, .72);
    --glass-border: rgba(255, 255, 255, .12);
    --glass-shadow: 0 6px 24px rgba(0, 0, 0, .5);
    --tab-active: rgba(255, 255, 255, .12);
    --scrim: rgba(0, 0, 0, .5);
    --edge-shade: rgba(0, 0, 0, .75);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-plain: #000000;
  --card: #1c1c1e;
  --label: #ffffff;
  --secondary: rgba(235, 235, 245, .6);
  --tertiary: rgba(235, 235, 245, .3);
  --separator: rgba(84, 84, 88, .6);
  --fill: rgba(120, 120, 128, .24);
  --blue: #0a84ff;
  --red: #ff453a;
  --green: #30d158;
  --glass: rgba(44, 44, 46, .72);
  --glass-border: rgba(255, 255, 255, .12);
  --glass-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  --tab-active: rgba(255, 255, 255, .12);
  --scrim: rgba(0, 0, 0, .5);
  --edge-shade: rgba(0, 0, 0, .75);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  --page-bg: var(--bg);
  margin: 0;
  background: var(--page-bg);
  color: var(--label);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  letter-spacing: -0.01em;
  min-height: 100vh;
}
body[data-view="calendar"][data-cal="month"] { --page-bg: var(--bg-plain); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }

main { max-width: 680px; margin: 0 auto; padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 110px); }

/* ---------- Liquid-glass controls ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: .5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.pill { height: 44px; padding: 0 16px; border-radius: 22px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.circle { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; }
.pill svg, .circle svg { width: 20px; height: 20px; }

.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  max-width: 712px; margin: 0 auto; pointer-events: none;
}
.topbar-right { display: flex; gap: 8px; margin-left: auto; pointer-events: auto; }
/* The two filter buttons, side by side in the page: under the date on Home,
   in the top row next to the gear on Calendar. */
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.filter-pill { font-size: 15px; max-width: 100%; min-width: 0; padding: 0 13px; gap: 5px; }
.filter-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-pill .pin { color: var(--red); width: 18px; height: 18px; }
.filter-pill .mic { color: #af52de; width: 18px; height: 18px; }
.filter-pill .down { width: 14px; height: 14px; color: var(--secondary); }
.cal-top { padding-right: 50px; }            /* keep clear of the gear */
.cal-top .filter-row { margin: 0 0 12px; }

/* Apple Music–style tab bar, sized for three tabs */
.tabbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 10px);
  height: 64px; border-radius: 32px;
  display: grid; grid-template-columns: repeat(3, 82px); padding: 5px; gap: 2px;
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 27px; font-size: 11px; font-weight: 600; color: var(--label); transition: background .2s, color .2s; }
.tab svg { width: 26px; height: 26px; }
.tab[aria-selected="true"] { color: var(--blue); background: var(--tab-active); }
/* iOS 26-style bottom edge: content darkens and softens as it scrolls under the tab bar,
   so the bar stays easy to see over busy rows. */
body::after {
  content: ""; position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; pointer-events: none;
  height: calc(var(--safe-bottom) + 120px);
  background: linear-gradient(to bottom, transparent, var(--edge-shade) 70%);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%); mask-image: linear-gradient(to bottom, transparent, #000 45%);
}

.today-btn { position: fixed; z-index: 19; left: max(16px, calc(50% - 340px)); bottom: calc(var(--safe-bottom) + 86px); height: 46px; padding: 0 24px; font-size: 17px; font-weight: 500; }
body:not([data-view="calendar"]) .today-btn, body[data-cal="list"] .today-btn { display: none; }

/* ---------- Titles ---------- */
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .01em; margin: 2px 56px 4px 4px; }
.subtitle { color: var(--secondary); font-size: 15px; margin: 0 4px 18px; }
.home-status { margin: 10px 4px 4px; }   /* Home: sits just under the filter buttons */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 4px 8px; }
.section-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: .01em; }
.section-note { color: var(--secondary); font-size: 13px; margin: -4px 4px 8px; }
.small-pill { font-size: 15px; font-weight: 600; color: #fff; background: var(--blue); padding: 6px 14px; border-radius: 16px; }
/* ---------- Calendar (month grid) ---------- */
.weekdays {
  position: sticky; z-index: 5; top: calc(var(--safe-top) + 60px);
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 12px; font-weight: 600; color: var(--label); padding: 6px 0;
  margin: 0 -16px; background: var(--bg-plain); border-bottom: .5px solid var(--separator);
}
.weekdays span:first-child, .weekdays span:last-child { color: var(--secondary); }
.month { margin: 0 -16px 8px; }
.month-title { font-size: 34px; font-weight: 700; margin: 22px 20px 6px; letter-spacing: .01em; }
.month + .month .month-title { font-size: 28px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.day { height: 78px; border-top: .5px solid var(--separator); display: flex; flex-direction: column; align-items: center; padding-top: 8px; gap: 8px; }
.day .num { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; font-weight: 500; font-variant-numeric: tabular-nums; }
.day.weekend .num { color: var(--secondary); }
.day.past .num { color: var(--tertiary); }
.day.today .num { background: var(--red); color: #fff; font-weight: 600; }
.day.has { cursor: pointer; }
.day.has:active .num { background: var(--fill); }
.day.today.has:active .num { background: var(--red); }
.dots { display: flex; gap: 3px; height: 7px; }
.dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--c); opacity: .75; }
.dots i.bar { width: 18px; }
.cal-empty { color: var(--secondary); text-align: center; font-size: 15px; margin: 18px 20px 0; }

/* ---------- Reminders-style tiles ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { position: relative; height: 88px; border-radius: 22px; padding: 12px 14px; color: #fff; text-align: left; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: var(--g); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tile svg { width: 30px; height: 30px; }
.tile .count { position: absolute; right: 14px; top: 8px; font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .label { font-size: 17px; font-weight: 600; }
.tile.selected { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px var(--blue); }
.t-blue { --g: linear-gradient(135deg, #6db8f2, #3d8fe6); }
.t-red { --g: linear-gradient(135deg, #f19a9a, #e5636a); }
.t-dark { --g: linear-gradient(135deg, #5b5b5f, #2c2c2e); }
.t-grey { --g: linear-gradient(135deg, #a7adb3, #7d858d); }

/* iOS segmented control (Calendar: Month | List) */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; margin: 6px 0 4px; background: var(--fill); border-radius: 10px; }
.seg button { height: 30px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--label); }
.seg button[aria-selected="true"] { background: var(--card); box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
:root[data-theme="dark"] .seg button[aria-selected="true"] { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-selected="true"] { background: #636366; } }

/* Home: "Next Up" card */
.hero { width: 100%; display: flex; gap: 16px; align-items: stretch; padding: 16px; text-align: left; }
.hero:active { background: var(--fill); }
/* Next Up: artist photo (or colored initial) in a circle exactly as tall as the text
   beside it, so the space above, below and to its left is the same 16pt. */
.hero { --hero-h: 88px; }
.hero-photo { flex: none; width: var(--hero-h); height: var(--hero-h); border-radius: 50%; overflow: hidden; background: var(--c, var(--fill)); color: #fff; display: grid; place-items: center; font-size: 32px; font-weight: 700; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-main { min-width: 0; height: var(--hero-h); display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.hero-main .row-sub { margin-top: 0; }
.hero-when { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--secondary); }   /* the show's date */
.hero-artist { font-size: 22px; font-weight: 700; color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-where { font-size: 15px; color: var(--c); font-weight: 600; }   /* countdown: "In 11 days" */

/* ---------- Inset grouped lists ---------- */
.card { background: var(--card); border-radius: 26px; overflow: hidden; }
.row { width: 100%; min-height: 60px; display: flex; align-items: center; gap: 14px; padding: 10px 16px; text-align: left; position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 16px; left: 70px; border-top: .5px solid var(--separator); }
button.row:active, a.row:active { background: var(--fill); }
/* Tapping anywhere on an input row (e.g. the + before "Add a city") focuses its field,
   but the pointer stays the normal arrow there; the field itself still shows the text cursor. */
label.row { cursor: default; }
.row-icon { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: var(--c, var(--blue)); font-weight: 600; font-size: 15px; overflow: hidden; }
.row-icon svg { width: 22px; height: 22px; }
.row-icon img { width: 100%; height: 100%; object-fit: cover; }
/* Spotify's own mark: black bars filling a Spotify-green circle */
.row-icon.spotify { background: #000; color: #1ed760; }   /* like Spotify’s app icon: green logo on black */
.row-icon.spotify svg { width: 76%; height: 76%; }
.row-icon.date { flex-direction: column; gap: 0; line-height: 1; }
.row-icon.date b { font-size: 16px; }
.row-icon.date small { font-size: 9px; font-weight: 700; text-transform: uppercase; opacity: .9; }
.row-main { flex: 1; min-width: 0; }
button.row-main { text-align: left; display: block; }   /* e.g. a trip's name in Settings: tap to rename */
.row-title { display: block; font-size: 17px; color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: 15px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row-detail { color: var(--secondary); font-size: 17px; flex: none; font-variant-numeric: tabular-nums; }
.row .chev { width: 14px; height: 14px; color: var(--tertiary); }
.row-btn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.row-btn svg { width: 16px; height: 16px; }
.row-btn.add { background: var(--blue); color: #fff; }
.row-btn.dismiss { color: var(--tertiary); }
.row input, .row select { font: inherit; color: var(--label); background: transparent; border: 0; outline: 0; min-width: 0; }
.row input { flex: 1; }
.row select { color: var(--secondary); text-align: right; font-size: 16px; }
.row .link-text { color: var(--blue); }
.row .destructive { color: var(--red); }
.empty-row { padding: 18px 16px; color: var(--secondary); font-size: 15px; text-align: center; }
.footnote { color: var(--secondary); font-size: 13px; margin: 8px 16px 0; line-height: 1.4; }
.footnote code { font-size: 12px; word-break: break-all; }

/* ---------- Bottom sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 680px;
  max-height: calc(100% - var(--safe-top) - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 30px 30px 0 0; padding: 8px 16px calc(var(--safe-bottom) + 28px);
  animation: rise .32s cubic-bezier(.2, .9, .25, 1);
}
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--tertiary); margin: 0 auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.sheet-head h2 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: .01em; }
.sheet-head .circle { width: 36px; height: 36px; background: var(--fill); box-shadow: none; border: 0; color: var(--secondary); }
.sheet-head .circle svg { width: 16px; height: 16px; }
.sheet .section-head { margin-top: 22px; }
.sheet .section-title { font-size: 20px; }
.detail-hero { text-align: center; padding: 8px 0 18px; }
.detail-hero .row-icon { width: 72px; height: 72px; margin: 0 auto 10px; font-size: 26px; }
.detail-hero h3 { font-size: 24px; margin: 0 0 4px; }
.detail-hero p { margin: 0; color: var(--secondary); font-size: 16px; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* Small pieces */
.results .row { min-height: 50px; }
.link-text { color: var(--blue); }
button.link-text { font-size: inherit; }
.new-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); margin-right: 7px; vertical-align: 2px; }
.gap { height: 22px; }
/* iOS large button, e.g. Done when adding a place */
.done-btn { display: block; width: 100%; height: 50px; margin-top: 14px; border-radius: 14px; background: var(--blue); color: #fff; font-size: 17px; font-weight: 600; }
.done-btn:active { opacity: .8; }
/* Under Done when editing a place: plain red text button, iOS-style */
.remove-btn { display: block; width: 100%; height: 44px; margin-top: 6px; color: var(--red); font-size: 17px; }
.check { color: var(--blue); display: grid; }
/* iOS multi-select circle: empty ring, or filled blue with a white check */
.checkcircle { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--tertiary); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.checkcircle.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.checkcircle svg { width: 15px; height: 15px; }
.check.ok { color: var(--green); }
.row input.right { text-align: right; color: var(--secondary); }
.row input.date-input { flex: none; color: var(--blue); }

/* Toast */
/* Occasional messages (mostly errors): a small single-line glass capsule that rises just
   above the tab bar, clear of the top controls and the Dynamic Island. */
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--safe-bottom) + 86px); transform: translate(-50%, 12px) scale(.96); opacity: 0; visibility: hidden; padding: 9px 16px; border-radius: 20px; font-size: 14px; font-weight: 500; max-width: calc(100% - 48px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform .25s cubic-bezier(.2, .9, .25, 1), opacity .2s, visibility 0s .25s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; visibility: visible; transition: transform .25s cubic-bezier(.2, .9, .25, 1), opacity .2s; }

/* iOS-style activity indicator inside a status line ("Checking for new dates…") */
.spinner { display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -1px; border-radius: 50%; border: 2px solid var(--tertiary); border-top-color: var(--secondary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none; } .toast { transition: none; } }

/* ---------- sign-in ---------- */
body.signed-out .topbar, body.signed-out .tabbar, body.signed-out .today-btn, body.signed-out main > .view { display: none !important; }
body.signed-out::after { display: none; }
body:not(.signed-out) .view-welcome { display: none; }
.welcome { max-width: 420px; margin: 0 auto; padding: 9vh 4px 0; text-align: center; }
.welcome-icon { width: 92px; height: 92px; border-radius: 22px; box-shadow: 0 6px 20px rgba(0, 0, 0, .15); }
.welcome h1 { font-size: 34px; font-weight: 700; margin: 18px 0 6px; }
.welcome-sub { color: var(--secondary); font-size: 17px; line-height: 1.35; margin: 0 12px 30px; }
.welcome-note { font-size: 15px; margin: 0 0 12px; overflow-wrap: anywhere; }
.welcome .card { text-align: left; }
.welcome input { width: 100%; font-size: 17px; }
.code-input { text-align: center; font-size: 28px !important; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.big-btn { display: block; width: 100%; height: 52px; margin-top: 14px; border-radius: 26px; background: var(--blue); color: #fff; font-size: 17px; font-weight: 600; }
.big-btn:disabled { opacity: .55; }
.footnote.center { text-align: center; margin-top: 16px; }
.footnote a, .footnote .link-text { color: var(--blue); font-size: inherit; }
.card.tip { margin-bottom: 18px; }

/* ---------- feedback ---------- */
.feedback-text { display: block; width: 100%; min-height: 150px; padding: 14px 16px; border: 0; outline: 0; resize: none; background: transparent; color: var(--label); font: inherit; font-size: 17px; line-height: 1.35; }
.feedback-text::placeholder { color: var(--tertiary); }
