/* FamilyHub app — shared styles for iphone, web, desktop, tv, watch.
   Layered on top of /colors_and_type.css and /tokens-extended.css.
*/

@import url("../colors_and_type.css");
@import url("../tokens-extended.css");

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-text);
  color: var(--label-primary);
  background: #000;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Accent override hook (for tweak) */
:root[data-accent="purple"] { --color-accent: #BF5AF2; --accent-blue: #BF5AF2; }
:root[data-accent="green"]  { --color-accent: #30D158; --accent-blue: #30D158; }
:root[data-accent="orange"] { --color-accent: #FF9F0A; --accent-blue: #FF9F0A; }

/* Reusable utility ------------------------------------------------------ */

.fh-icon-btn {
  width: 44px; height: 44px;
  border-radius: 999px;
  background: var(--material-thick);
  backdrop-filter: var(--blur-material);
  -webkit-backdrop-filter: var(--blur-material);
  border: 0.5px solid var(--material-hairline);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--label-primary);
  transition: transform 120ms;
}
.fh-icon-btn:active { transform: scale(0.94); }

.fh-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--fill-2); color: var(--label-primary);
  font-size: 12px; font-weight: 600;
}
.fh-pill[data-tone="success"] { background: rgba(48, 209, 88, 0.18); color: var(--accent-green); }
.fh-pill[data-tone="warning"] { background: rgba(255, 159, 10, 0.18); color: var(--accent-orange); }
.fh-pill[data-tone="danger"]  { background: rgba(255, 69, 58, 0.18); color: var(--accent-red); }
.fh-pill[data-tone="info"]    { background: rgba(10, 132, 255, 0.18); color: var(--accent-blue); }

.fh-btn {
  height: 50px; padding: 0 20px; border-radius: 14px;
  border: none; cursor: pointer; font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-text); transition: transform 120ms, opacity 200ms;
}
.fh-btn:active { transform: scale(0.98); }
.fh-btn[data-variant="primary"] { background: var(--color-accent); color: #FFF; }
.fh-btn[data-variant="secondary"] { background: var(--fill-2); color: var(--label-primary); }
.fh-btn[data-variant="ghost"] { background: transparent; color: var(--color-accent); }
.fh-btn[data-variant="oauth-apple"] { background: #000; color: #FFF; border: 0.5px solid rgba(255,255,255,0.15); }
.fh-btn[data-variant="oauth-google"] { background: #FFF; color: #1F1F1F; border: 0.5px solid rgba(0,0,0,0.1); }
.fh-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.fh-input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px;
  background: var(--fill-1); border: 0.5px solid var(--separator);
  color: var(--label-primary); font-size: 17px;
  font-family: var(--font-text); outline: none; transition: border-color 160ms;
}
.fh-input:focus { border-color: var(--color-accent); }
.fh-input::placeholder { color: var(--label-tertiary); }

.fh-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; min-height: 56px;
}
.fh-row + .fh-row { border-top: 0.5px solid var(--separator); }

.fh-avatar {
  width: 44px; height: 44px; border-radius: 999px;
  flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill-3); color: var(--label-primary);
  font-weight: 600; font-size: 14px;
  position: relative;
}
.fh-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fh-avatar[data-presence] { box-shadow: 0 0 0 0; }
.fh-avatar[data-presence="online"]::after,
.fh-avatar[data-presence="recent"]::after,
.fh-avatar[data-presence="away"]::after {
  content: ''; position: absolute;
  width: 12px; height: 12px; border-radius: 999px;
  bottom: -1px; right: -1px;
  border: 2px solid var(--material-thick);
}
.fh-avatar[data-presence="online"]::after { background: var(--accent-green); }
.fh-avatar[data-presence="recent"]::after { background: var(--accent-orange); }
.fh-avatar[data-presence="away"]::after   { background: var(--accent-gray); }

/* Battery glyph -------------------------------------------------------- */
.fh-battery {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--label-secondary);
  font-variant-numeric: tabular-nums;
}
.fh-battery svg { width: 22px; height: 12px; }
.fh-battery rect.shell { fill: none; stroke: currentColor; stroke-width: 1; rx: 2; }
.fh-battery rect.fill { rx: 1; }
.fh-battery[data-low="true"] rect.fill { fill: var(--accent-red); }
.fh-battery:not([data-low="true"]) rect.fill { fill: var(--accent-green); }

/* Bottom sheet (merged with tab bar) ----------------------------------- */
.fh-sheet {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  background: var(--material-thick);
  backdrop-filter: var(--blur-material);
  -webkit-backdrop-filter: var(--blur-material);
  border: 0.5px solid var(--material-hairline);
  border-radius: 28px;
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 350ms cubic-bezier(0.32, 0.72, 0, 1), height 350ms cubic-bezier(0.32, 0.72, 0, 1);
}
.fh-sheet[data-detent="hidden"] { transform: translateY(120%); }

.fh-sheet-grabber {
  width: 36px; height: 5px; border-radius: 999px;
  background: var(--label-quaternary);
  margin: 8px auto 0;
  cursor: grab;
}

.fh-sheet-content {
  flex: 1; overflow-y: auto;
  padding: 8px 16px 0;
  -webkit-overflow-scrolling: touch;
}
.fh-sheet-content::-webkit-scrollbar { display: none; }

/* Tab bar inside sheet */
.fh-tabbar {
  display: flex; justify-content: space-around;
  padding: 6px 4px 14px;
  border-top: 0.5px solid var(--separator);
  background: transparent;
}
.fh-tabbar button {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; color: var(--label-tertiary);
  font-family: var(--font-text);
}
.fh-tabbar button[data-active="true"] { color: var(--color-accent); }
.fh-tabbar button .label {
  font-size: 10px; font-weight: 600; letter-spacing: 0;
}
.fh-tabbar button svg { width: 24px; height: 24px; }

/* Map background ------------------------------------------------------- */
.fh-map {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  z-index: 0;
}
.fh-map[data-style="dark"] { background-image: url('assets/map-dark.svg'); }
.fh-map[data-style="light"] { background-image: url('assets/map-light.svg'); }
.fh-map[data-style="satellite"] {
  background:
    radial-gradient(ellipse at 30% 20%, #3a4f3a 0%, #1a2b22 70%),
    linear-gradient(180deg, #1F2A1F 0%, #0F1812 100%);
}
.fh-map[data-style="satellite"]::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 22% 35%, rgba(40,55,40,0.8) 0%, transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(35,50,35,0.7) 0%, transparent 35%),
    radial-gradient(circle at 80% 25%, rgba(70,80,55,0.6) 0%, transparent 30%);
}

/* Map pin -------------------------------------------------------------- */
.fh-pin {
  position: absolute;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.fh-pin .ring {
  position: absolute; inset: 0;
  border-radius: 999px;
  border: 3px solid #FFF;
  background: var(--pin-color, #0A84FF);
  overflow: hidden;
}
.fh-pin .ring img { width: 100%; height: 100%; object-fit: cover; }
.fh-pin .halo {
  position: absolute; inset: -16px;
  border-radius: 999px;
  background: var(--pin-color, #0A84FF);
  opacity: 0.18;
  animation: fh-halo 1.6s ease-in-out infinite;
}
@keyframes fh-halo {
  0%, 100% { transform: scale(0.8); opacity: 0.18; }
  50% { transform: scale(1.2); opacity: 0; }
}

/* Geofence on map (style 2 — dashed polygon green) --------------------- */
.fh-geofence {
  position: absolute;
  border: 2px dashed var(--accent-green);
  background: rgba(48, 209, 88, 0.18);
  border-radius: 24% 12% 18% 30%;
  pointer-events: none;
}

/* Onboarding ----------------------------------------------------------- */
.fh-onboarding {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--map-bg-top);
}
.fh-onb-illust {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fh-onb-foot {
  padding: 20px 24px 32px;
  display: flex; flex-direction: column; gap: 14px;
}
.fh-onb-dots {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 8px;
}
.fh-onb-dots span {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--label-quaternary); transition: width 200ms, background 200ms;
}
.fh-onb-dots span[data-active="true"] {
  width: 22px; background: var(--color-accent);
}

/* Auth ----------------------------------------------------------------- */
.fh-auth {
  position: absolute; inset: 0; padding: 70px 24px 32px;
  display: flex; flex-direction: column; gap: 16px;
  background: var(--map-bg-top);
  overflow-y: auto;
}
.fh-auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0; color: var(--label-tertiary);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.fh-auth-divider::before, .fh-auth-divider::after {
  content: ''; flex: 1; height: 0.5px; background: var(--separator);
}

/* Sheet pages — section headers --------------------------------------- */
.fh-sheet-h1 {
  font-size: 28px; font-weight: 700; color: var(--label-primary);
  letter-spacing: -0.02em; line-height: 1.15;
}
.fh-sheet-h2 {
  font-size: 13px; font-weight: 600; color: var(--label-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 18px 4px 8px;
}

/* Notification dot on tab */
.fh-tab-badge {
  position: absolute; top: 4px; right: 28%;
  background: var(--accent-red); color: #FFF;
  font-size: 9px; font-weight: 700;
  width: 14px; height: 14px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}

/* QR placeholder */
.fh-qr {
  width: 220px; height: 220px;
  background: #FFF;
  border-radius: 18px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  padding: 18px;
}
.fh-qr svg { width: 100%; height: 100%; }
.fh-qr-logo {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  background: var(--color-accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #FFF; font-weight: 700; font-size: 18px;
  border: 3px solid #FFF;
}

/* 6-digit code input */
.fh-code-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  margin: 16px 0;
}
.fh-code-grid input {
  height: 60px; text-align: center;
  font-size: 26px; font-weight: 700;
  background: var(--fill-1); border: 0.5px solid var(--separator);
  border-radius: 12px; color: var(--label-primary);
  font-family: var(--font-mono); outline: none;
}
.fh-code-grid input:focus { border-color: var(--color-accent); }

/* Trips */
.fh-trip-card {
  background: var(--fill-1); border-radius: 14px;
  padding: 12px; margin-bottom: 10px;
  display: flex; gap: 12px; align-items: center;
}
.fh-trip-thumb {
  width: 64px; height: 64px; border-radius: 10px;
  background: var(--fill-2); flex-shrink: 0;
  position: relative; overflow: hidden;
}
.fh-trip-thumb svg { width: 100%; height: 100%; }

/* Notifications */
.fh-notif {
  display: flex; gap: 12px; padding: 12px;
  border-radius: 12px; background: var(--fill-1);
  margin-bottom: 8px;
}
.fh-notif .icon {
  width: 36px; height: 36px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fh-notif .body { flex: 1; }
.fh-notif .title { font-size: 14px; font-weight: 600; color: var(--label-primary); margin-bottom: 2px; }
.fh-notif .meta { font-size: 12px; color: var(--label-secondary); }

/* Settings */
.fh-settings-group {
  background: var(--fill-1); border-radius: 14px;
  margin-bottom: 14px; overflow: hidden;
}

/* Map mode picker (modal sheet) */
.fh-map-modes {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 16px 0;
}
.fh-map-mode-tile {
  aspect-ratio: 1.4;
  border-radius: 14px;
  overflow: hidden;
  background: var(--fill-2);
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 160ms;
}
.fh-map-mode-tile[data-active="true"] {
  border-color: var(--color-accent);
}
.fh-map-mode-tile .label {
  position: absolute; bottom: 6px; left: 8px;
  font-size: 13px; font-weight: 600; color: #FFF;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* Page transitions */
.fh-page-enter { animation: fh-page-in 280ms cubic-bezier(0.32, 0.72, 0, 1); }
@keyframes fh-page-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Tweaks panel sits above status bar — let the merge happen */
[data-edit-mode="off"] .__tweaks-panel { display: none; }
