/* ============================================================================
   app-native.css — makes WedTrack feel like a native app INSIDE the iOS shell.
   Everything here is gated behind `body.is-app`, which app-native.js only adds
   when running in the Capacitor app. On a normal desktop/mobile browser none of
   this applies, so the website is unchanged.
   ========================================================================== */

/* ---- App-wide feel: no pinch-zoom jank, no text selection, no tap flash ---- */
body.is-app {
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior-y: none;
}
/* but keep real inputs selectable/usable */
body.is-app input,
body.is-app textarea,
body.is-app select,
body.is-app [contenteditable] {
  -webkit-user-select: auto;
  user-select: auto;
}

/* iOS zooms the page when you focus an input under 16px — force 16px to stop it */
body.is-app input,
body.is-app textarea,
body.is-app select {
  font-size: 16px;
}

/* iOS date/time inputs have an intrinsic min-width and ignore width:100%, so they
   overflow the page. Strip the native chrome so they shrink to the container
   (the picker still opens on tap). */
body.is-app input[type="date"],
body.is-app input[type="time"],
body.is-app input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* ---- Hide the website-y top nav; the bottom tab bar replaces it ---- */
body.is-app .nav { display: none !important; }

/* ---- Detail page: keep its back-button nav, but clear the status bar ---- */
body.is-app .detail-nav {
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}

/* ---- Compact, less "marketing" hero; clear the status bar via safe area ---- */
body.is-app .app-hero {
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
  padding-bottom: 16px;
}

body.is-app .app-tagline { display: none; }      /* drop the long marketing line */
body.is-app .app-headline { font-size: 1.9rem; line-height: 1.1; }

/* Center the Home content between the hero and the tab bar (no dead space below
   'View your full roster'). The tab bar is reserved on #homeView so the
   centering happens in the visible area; Home doesn't scroll. */
body.is-app #homeView {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
body.is-app #homeView .home-main { flex: 1 1 auto; justify-content: center; padding-bottom: 24px; }

/* On very tall phones (6.7"/6.9") pure centering leaves a big void under the
   hero. Spread the content to fill instead: greeting near the hero, button near
   the tab bar, breathing room shared between sections. Shorter phones stay centered. */
@media (min-height: 900px) {
  body.is-app #homeView .home-main { justify-content: space-evenly; padding-top: 4px; padding-bottom: 4px; }
}

/* ---- Roomier, thumb-friendly controls ---- */
body.is-app .btn { min-height: 46px; padding-left: 20px; padding-right: 20px; }
body.is-app .btn-sm { min-height: 40px; }
body.is-app .filter-btn { min-height: 40px; padding: 9px 16px; }
body.is-app .fi,
body.is-app .search-input,
body.is-app .sort-select { min-height: 46px; }
body.is-app .view-btn,
body.is-app .events-toggle,
body.is-app .cal-btn { min-height: 40px; }

/* Smooth, springy taps on interactive things */
body.is-app .btn,
body.is-app .filter-btn,
body.is-app .view-btn,
body.is-app .w-card,
body.is-app .app-tab { transition: transform .12s ease, background .15s ease, color .15s ease; }
body.is-app .w-card:active { transform: scale(.985); }

/* ---- Leave room so the last cards aren't hidden behind the tab bar ---- */
body.is-app .app-roster,
body.is-app .home-main {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 24px);
}

/* ---- Roster: clear the status bar / Dynamic Island at the top (edge-to-edge),
        so the 'Home' / 'Due soon' row isn't tucked under it ---- */
body.is-app .app-roster {
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
}

/* ---- Modals: clear the status bar up top and the tab bar at the bottom so the
        whole form (incl. the Save button) is scrollable into view ---- */
body.is-app .modal-overlay {
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 24px);
}

/* ============================================================================
   Bottom tab bar
   ========================================================================== */
.app-tabbar { display: none; }   /* hidden unless in app */
body.is-app .app-tabbar {
  display: flex;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  align-items: flex-start;
  justify-content: space-around;
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: rgba(252, 252, 247, .94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-lt);
}

.app-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--faint);
  font-family: 'Inter', sans-serif;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: .02em;
}
.app-tab:active { transform: scale(.92); }
.app-tab.is-active { color: var(--tan); }
.app-tab-ico {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.app-tab-ico svg { width: 23px; height: 23px; display: block; }

/* Center raised "Add" button */
.app-tab-add { position: relative; }
.app-tab-add .app-tab-ico {
  width: 52px; height: 52px;
  margin-top: -22px;
  border-radius: 50%;
  background: var(--tan);
  color: var(--white);
  box-shadow: 0 6px 16px rgba(63, 107, 83, .38);
  border: 3px solid var(--white);
}
.app-tab-add .app-tab-ico svg { width: 26px; height: 26px; }
.app-tab-add:active .app-tab-ico { background: var(--tan-dk); }

/* ============================================================================
   Account bottom sheet
   ========================================================================== */
.app-sheet-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(20, 18, 12, .38);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.app-sheet-overlay.is-open { opacity: 1; pointer-events: auto; }
.app-sheet {
  width: 100%;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.22,.61,.36,1);
  box-shadow: 0 -8px 32px rgba(20, 14, 6, .18);
  max-height: 90vh;
  overflow-y: auto;
}
.app-sheet-overlay.is-open .app-sheet { transform: translateY(0); }
.app-sheet-handle {
  width: 44px; height: 5px; border-radius: 3px;
  background: var(--border); background-clip: content-box;
  padding: 10px 28px; box-sizing: content-box;   /* small bar, big tap target */
  margin: 0 auto 8px; cursor: pointer;
}

/* Profile header */
.app-profile { text-align: center; margin: 4px 0 18px; }
.app-avatar {
  width: 64px; height: 64px; margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--tan); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem; font-weight: 600; line-height: 1;
  box-shadow: 0 6px 16px rgba(63, 107, 83, .32);
}
.app-profile-email {
  color: var(--ink);
  font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 500;
  word-break: break-all;
}

/* Section labels */
.app-sheet-section {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
  margin: 16px 4px 8px;
}

.app-sheet-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px;
  padding: 0 16px; margin-bottom: 8px;
  background: var(--white);
  border: 1px solid var(--border-lt);
  border-radius: 12px;
  font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 500;
  color: var(--ink); cursor: pointer;
  text-align: left;
}
.app-sheet-btn:active { background: var(--sand); transform: scale(.99); }
.app-sheet-btn.is-danger { color: #b03a2e; }
.app-sheet-btn .app-sheet-btn-label { flex: 1; }
.app-sheet-btn .app-sheet-chev { color: var(--muted); font-size: 1.3rem; line-height: 1; }
.app-sheet-ico { width: 22px; display: flex; align-items: center; justify-content: center; color: var(--tan); }
.app-sheet-btn.is-danger .app-sheet-ico { color: #b03a2e; }
.app-sheet-ico svg { width: 20px; height: 20px; }
.app-signout { margin-top: 18px; }

/* Preference rows */
.app-sheet-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px;
  padding: 0 16px; margin-bottom: 8px;
  background: var(--white);
  border: 1px solid var(--border-lt);
  border-radius: 12px;
}
.app-sheet-row-label {
  flex: 1;
  font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 500;
  color: var(--ink);
}

/* Toggle switch */
.app-switch {
  position: relative;
  width: 46px; height: 28px; flex: 0 0 auto;
  border: none; border-radius: 999px;
  background: var(--border); cursor: pointer;
  transition: background .18s ease; padding: 0;
}
.app-switch.is-on { background: var(--tan); }
.app-switch-knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .18s ease;
}
.app-switch.is-on .app-switch-knob { transform: translateX(18px); }

/* Row variant: label on top, control wraps full-width below (for many options) */
.app-sheet-row--stack { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.app-sheet-row--stack .app-sheet-row-label { display: flex; align-items: center; gap: 12px; }

/* Segmented control */
.app-seg {
  display: inline-flex; flex: 0 0 auto;
  background: var(--sand); border-radius: 9px; padding: 3px;
}
.app-seg--wrap { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: 3px; margin-top: 10px; }
.app-seg button {
  border: none; background: transparent; cursor: pointer;
  padding: 5px 12px; border-radius: 7px;
  font-family: 'Inter', sans-serif; font-size: 0.82rem; font-weight: 500;
  color: var(--muted);
}
.app-seg button.is-on {
  background: var(--white); color: var(--ink);
  box-shadow: 0 1px 2px rgba(20,14,6,.12);
}

/* Sub-views (change password / delete) */
.app-sheet-subhead {
  position: relative;
  text-align: center; margin: 2px 0 16px;
  font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; color: var(--ink);
}
.app-sheet-back {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--tan);
  padding: 6px 8px 6px 0;
}
.app-sheet-input {
  width: 100%; min-height: 50px;
  padding: 0 14px; margin-bottom: 10px;
  background: var(--white);
  border: 1px solid var(--border-lt); border-radius: 12px;
  font-family: 'Inter', sans-serif; font-size: 0.95rem; color: var(--ink);
}
.app-sheet-input:focus { outline: none; border-color: var(--tan); }
.app-sheet-warn {
  font-family: 'Inter', sans-serif; font-size: 0.86rem; line-height: 1.45;
  color: var(--muted); margin: 0 2px 14px;
}
.app-sheet-msg {
  font-family: 'Inter', sans-serif; font-size: 0.82rem;
  margin: 2px 2px 10px; color: var(--sage);
}
.app-sheet-msg.is-err { color: #b03a2e; }
.app-sheet-cta {
  width: 100%; min-height: 52px; margin-top: 4px;
  border: none; border-radius: 12px; cursor: pointer;
  background: var(--tan); color: var(--white);
  font-family: 'Inter', sans-serif; font-size: 0.95rem; font-weight: 600;
}
.app-sheet-cta:active { transform: scale(.99); }
.app-sheet-cta[disabled] { opacity: .6; }
.app-sheet-cta.is-danger { background: #b03a2e; }

/* ============================================================================
   Pull-to-refresh
   ========================================================================== */
.app-ptr {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  left: 50%; transform: translateX(-50%) translateY(-60px);
  z-index: 1050;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s ease;
}
.app-ptr.is-visible { opacity: 1; }
.app-ptr svg { width: 20px; height: 20px; color: var(--tan); }
.app-ptr.is-spinning svg { animation: app-ptr-spin .7s linear infinite; }
@keyframes app-ptr-spin { to { transform: rotate(360deg); } }
