/**
 * pf-fitness.css: Planet Fitness inspired fitness front screen + neon systems.
 *
 * 1. Neon section border system: every pillar screen gets a subtle neon
 *    frame in its own pillar color via the --pillar-color var the panel
 *    already sets. All six pillars covered by one rule.
 * 2. Fitness front screen: search bar + 5 glowing category boxes.
 * 3. Coach chatbot bubble + chat sheet.
 *
 * Fallbacks come first: plain var() declarations, then color-mix overrides
 * for browsers that support it.
 */

/* ============ 1. NEON SECTION BORDER SYSTEM ============ */

.pillar-detail-panel.open[data-pillar-screen] {
  border: 2px solid var(--pillar-color);
  border-color: color-mix(in srgb, var(--pillar-color) 55%, transparent);
  box-shadow:
    inset 0 0 4px var(--pillar-color),
    inset 0 0 22px var(--pillar-color);
  box-shadow:
    inset 0 0 4px color-mix(in srgb, var(--pillar-color) 60%, transparent),
    inset 0 0 22px color-mix(in srgb, var(--pillar-color) 35%, transparent),
    inset 0 0 60px color-mix(in srgb, var(--pillar-color) 12%, transparent);
  box-sizing: border-box;
}

/* ============ 2. FITNESS FRONT SCREEN ============ */

.fit-home {
  padding: 8px 16px 4px;
  position: relative;
  z-index: 1;
}

/* Search bar */
.fit-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin: 6px 0 18px;
}
.fit-search-icon {
  position: absolute;
  left: 16px;
  color: rgba(255, 255, 255, 0.45);
  display: flex;
  pointer-events: none;
}
.fit-search {
  width: 100%;
  padding: 15px 44px 15px 46px;
  font-size: 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  outline: none;
  -webkit-appearance: none;
}
.fit-search::placeholder { color: rgba(255, 255, 255, 0.4); }
.fit-search:focus {
  border-color: var(--pillar-color, #9b59ff);
  box-shadow: 0 0 12px color-mix(in srgb, var(--pillar-color, #9b59ff) 40%, transparent);
}
.fit-search-clear {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

/* 5 category boxes: 2-col grid, 5th spans both */
.fit-cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-bottom: 8px;
}
.fit-cat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 132px;
  padding: 18px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: linear-gradient(150deg, #6a359e 0%, #4a2370 55%, #33184f 100%);
  color: #fff;
  cursor: pointer;
  /* Outer glow matches the page border inner glow (body purple #9B59FF) */
  box-shadow:
    0 0 4px rgba(155, 89, 255, 0.8),
    0 0 18px rgba(155, 89, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.fit-cat-box:last-child { grid-column: 1 / -1; min-height: 104px; }
.fit-cat-box:active { transform: scale(0.96); }
/* Scan Physique: the 6th starting button (full-width, teal to read as "scan") */
.fit-cat-box.fit-cat-scan {
  background: linear-gradient(150deg, #0e8a68 0%, #0a5f48 55%, #073d30 100%);
  box-shadow:
    0 0 4px rgba(64, 224, 160, 0.8),
    0 0 18px rgba(64, 224, 160, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.fit-cat-icon { color: #fff; display: flex; filter: drop-shadow(0 0 6px rgba(255,255,255,0.35)); }
.fit-cat-label { font-size: 17px; font-weight: 800; letter-spacing: 0.06em; }
.fit-cat-tag { font-size: 12px; color: rgba(255, 255, 255, 0.65); font-weight: 500; }

/* Results / drill-down list */
.fit-results { padding-bottom: 8px; }
.fit-list-head { margin: 2px 0 6px; }
.fit-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #9b59ff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0;
}
.fit-list-title { font-size: 24px; font-weight: 800; color: #fff; margin: 0 0 4px; }
.fit-list-sub { font-size: 14px; color: rgba(255, 255, 255, 0.55); margin: 0 0 14px; }
.fit-result-list { display: flex; flex-direction: column; gap: 10px; }
.fit-result-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.fit-result-card:active { transform: scale(0.98); }
.fit-result-title { font-size: 16px; font-weight: 700; color: #fff; }
.fit-result-meta { font-size: 13px; color: rgba(255, 255, 255, 0.5); }
.fit-empty { color: rgba(255, 255, 255, 0.55); font-size: 15px; line-height: 1.5; padding: 12px 4px; }

/* Detail bottom sheet */
.fit-sheet-wrap { position: fixed; inset: 0; z-index: 8100; pointer-events: none; }
.fit-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0; transition: opacity 0.25s ease;
  pointer-events: auto;
}
.fit-sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 82vh; overflow-y: auto;
  background: #14141c;
  border: 1px solid rgba(155, 89, 255, 0.35);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0.35, 1);
  pointer-events: auto;
  box-shadow: 0 0 30px rgba(155, 89, 255, 0.35);
}
.fit-sheet-wrap.show .fit-sheet-backdrop { opacity: 1; }
.fit-sheet-wrap.show .fit-sheet { transform: translateY(0); }
.fit-sheet-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.fit-sheet-kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; color: #9b59ff; margin: 0 0 6px; }
.fit-sheet-title { font-size: 24px; font-weight: 800; color: #fff; margin: 0 0 4px; padding-right: 40px; }
.fit-sheet-meta { font-size: 14px; color: rgba(255,255,255,0.55); margin: 0 0 18px; }
.fit-sheet-row { margin-bottom: 16px; }
.fit-sheet-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.45); margin-bottom: 6px; }
.fit-sheet-row p { font-size: 15px; line-height: 1.55; color: #fff; margin: 0; }
.fit-sheet-cta {
  width: 100%; padding: 16px;
  font-size: 17px; font-weight: 800; color: #fff;
  background: linear-gradient(150deg, #7c3aed, #5b2d8e);
  border: none; border-radius: 16px; cursor: pointer;
  box-shadow: 0 0 16px rgba(155, 89, 255, 0.5);
}
.fit-sheet-cta:active { transform: scale(0.98); }

/* ============ 3. COACH CHATBOT BUBBLE ============ */

.coach-wrap { position: fixed; inset: 0; z-index: 8100; pointer-events: none; }
.coach-fab {
  position: absolute;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 62px; height: 62px;
  border-radius: 50%;
  background: linear-gradient(150deg, #a86bff, #7c3aed);
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  box-shadow:
    0 0 6px rgba(155, 89, 255, 0.9),
    0 0 22px rgba(155, 89, 255, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease;
}
.coach-fab:active { transform: scale(0.92); }

/* Animated proactive pop-up bubble */
.coach-pop {
  position: absolute;
  right: 90px;
  bottom: calc(30px + env(safe-area-inset-bottom, 0px));
  max-width: 250px;
  background: #1c1c26;
  border: 1px solid rgba(155, 89, 255, 0.5);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 14px;
  cursor: pointer;
  pointer-events: auto;
  transform: scale(0);
  transform-origin: bottom right;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 18px rgba(155, 89, 255, 0.4), 0 8px 24px rgba(0,0,0,0.5);
}
.coach-pop.show { transform: scale(1); }
.coach-pop p { margin: 0; font-size: 13.5px; line-height: 1.5; color: #fff; }
.coach-pop b { color: #c4a5ff; }

/* Chat sheet */
.coach-sheet {
  position: absolute; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-height: 66vh;
  display: flex; flex-direction: column;
  background: #14141c;
  border: 1px solid rgba(155, 89, 255, 0.4);
  border-radius: 22px;
  overflow: hidden;
  pointer-events: auto;
  transform: translateY(30px) scale(0.97);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.35, 1), opacity 0.22s ease;
  box-shadow: 0 0 30px rgba(155, 89, 255, 0.35), 0 12px 40px rgba(0,0,0,0.6);
}
.coach-sheet.show { transform: none; opacity: 1; }
.coach-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(150deg, #6a359e, #4a2370);
}
.coach-sheet-title { font-size: 16px; font-weight: 800; color: #fff; }
.coach-sheet-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none;
  color: #fff; font-size: 14px; cursor: pointer;
}
.coach-thread {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 180px;
}
.coach-msg { max-width: 85%; }
.coach-msg p { margin: 0; font-size: 14.5px; line-height: 1.5; }
.coach-msg.coach {
  align-self: flex-start;
  background: rgba(155, 89, 255, 0.16);
  border: 1px solid rgba(155, 89, 255, 0.3);
  color: #fff;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 13px;
}
.coach-msg.user {
  align-self: flex-end;
  background: #7c3aed;
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 13px;
}
.coach-workout-card {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; text-align: left;
  margin-top: 8px; padding: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(155, 89, 255, 0.45);
  border-radius: 12px; cursor: pointer; color: #fff;
}
.coach-workout-card b { font-size: 15px; }
.coach-workout-card span { font-size: 12.5px; color: rgba(255,255,255,0.6); }
.coach-hint { font-size: 12px !important; color: rgba(255,255,255,0.5) !important; margin-top: 6px !important; }
.coach-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 14px 10px;
}
.coach-chip {
  flex: none;
  padding: 9px 14px;
  font-size: 13.5px; font-weight: 700; color: #d9c6ff;
  background: rgba(155, 89, 255, 0.14);
  border: 1px solid rgba(155, 89, 255, 0.45);
  border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.coach-chip:active { transform: scale(0.95); }
.coach-form { display: flex; gap: 8px; padding: 0 14px 14px; }
.coach-form input {
  flex: 1; padding: 12px 16px;
  font-size: 15px; color: #fff;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px; outline: none;
}
.coach-form input::placeholder { color: rgba(255,255,255,0.35); }
.coach-form button {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(150deg, #a86bff, #7c3aed);
  color: #fff; font-size: 18px;
  box-shadow: 0 0 12px rgba(155, 89, 255, 0.5);
}

/* ============ 4. FITNESS PROFILE SCREEN ============
 * Planet Fitness "Fitness Profile" format in Gamify's dark + purple look:
 * bold all-caps title + avatar, two hero stat cards, 2x2 stat tiles with
 * small line icons, two action buttons. Big numbers, one label each. */

.fit-profile {
  padding: 10px 16px 6px;
  position: relative;
  z-index: 1;
}

/* Title row: condensed all-caps title left, avatar button right */
.fit-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 16px;
}
.fit-profile-title {
  margin: 0;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: #fff;
  font-stretch: condensed;
}
.fit-profile-avatar {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(150deg, #a86bff, #7c3aed);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 0 6px rgba(155, 89, 255, 0.9),
    0 0 16px rgba(155, 89, 255, 0.5);
  transition: transform 0.15s ease;
}
.fit-profile-avatar:active { transform: scale(0.92); }

/* Two hero stat cards */
.fit-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.fit-hero-card {
  background: linear-gradient(150deg, rgba(155, 89, 255, 0.24) 0%, rgba(155, 89, 255, 0.07) 100%);
  border: 1px solid rgba(155, 89, 255, 0.42);
  border-radius: 20px;
  padding: 18px 16px 16px;
  box-shadow:
    0 0 4px rgba(155, 89, 255, 0.8),
    0 0 18px rgba(155, 89, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.fit-hero-num {
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
}
.fit-hero-label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

/* Four stat tiles, 2x2 */
.fit-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.fit-tile {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
}
.fit-tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.fit-tile-num {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.1;
}
.fit-tile-icon {
  color: #b78bff;
  display: flex;
  flex: none;
  filter: drop-shadow(0 0 5px rgba(155, 89, 255, 0.55));
}
.fit-tile-label {
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
}

/* Two action buttons */
.fit-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: 4px;
}
.fit-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(155, 89, 255, 0.38);
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(155, 89, 255, 0.28);
  transition: transform 0.15s ease;
}
.fit-action-btn:active { transform: scale(0.96); }
.fit-action-icon {
  color: #b78bff;
  display: flex;
  flex: none;
}

/* Workout history list (inside the reused bottom sheet) */
.fit-history-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fit-history-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
}
.fit-history-xp {
  flex: none;
  font-size: 13px;
  font-weight: 800;
  color: #9b59ff;
}
.fit-history-text {
  flex: 1;
  font-size: 14.5px;
  color: #fff;
  line-height: 1.4;
}
.fit-history-item time {
  flex: none;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.45);
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .coach-pop { transition: opacity 0.2s ease; transform: none; opacity: 0; }
  .coach-pop.show { opacity: 1; }
  .coach-sheet { transition: opacity 0.2s ease; transform: none; }
  .fit-cat-box, .fit-result-card, .fit-sheet-cta, .fit-profile-avatar, .fit-action-btn { transition: none; }
}
