/* VictoryLap Hub - AI Coach session page styles. */

:root { --amber: #f0a832; }

/* ---------- layout ---------- */
.coach-layout {
  display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start;
}
.coach-rail .hub-card { margin-bottom: 0; }
.coach-card-tight { padding: 26px 24px; }

/* ---------- gate banners ---------- */
.coach-gate {
  border-radius: 16px; padding: 22px 24px; margin-bottom: 20px;
  border: 1px solid var(--line); background: var(--black-2);
  font-size: 15px; line-height: 1.55;
}
.coach-gate strong { display: block; font-size: 17px; margin-bottom: 6px; }
.coach-gate-green { border-color: var(--lime); background: rgba(214, 255, 56, 0.07); }
.coach-gate-green strong { color: var(--lime); }
.coach-gate-amber { border-color: var(--amber); background: rgba(240, 168, 50, 0.07); }
.coach-gate-amber strong { color: var(--amber); }
.coach-gate-red { border-color: var(--red); background: rgba(224, 57, 43, 0.08); }
.coach-gate-red strong { color: #ff8a7a; }
.coach-gate-adj { margin-top: 12px; color: var(--bone); font-weight: 600; }
.coach-gate-form { margin-top: 18px; }
.coach-gate-form .field { margin-bottom: 16px; }

/* ---------- readiness row ---------- */
.coach-readiness {
  display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.coach-readiness-chip { padding-top: 4px; }
.coach-chip {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px;
  white-space: nowrap;
}
.coach-chip-green { color: var(--lime); border-color: var(--lime); }
.coach-chip-yellow { color: var(--amber); border-color: var(--amber); }
.coach-chip-red { color: #ff8a7a; border-color: var(--red); }
.coach-chip-none { color: var(--bone-dim); }
.coach-order {
  flex: 1; min-width: 240px;
  border: 1px solid var(--line); border-left: 4px solid var(--lime); border-radius: 12px;
  background: var(--black-2); padding: 18px 20px;
}
.coach-order .kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--lime); margin-bottom: 8px;
}
.coach-order-text { font-size: 19px; font-weight: 600; line-height: 1.45; color: var(--bone); }

/* ---------- session plan ---------- */
.coach-session h2 { margin-bottom: 4px; }
.coach-circuit { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.coach-circuit:first-of-type { border-top: none; padding-top: 0; }
.coach-circuit h3 {
  font-family: var(--font-display); text-transform: uppercase; font-weight: 400;
  font-size: 24px; margin-bottom: 4px;
}
.coach-ex {
  border: 1px solid var(--line); border-radius: 14px; background: var(--black);
  padding: 18px; margin-top: 14px;
}
.coach-ex-top { display: flex; align-items: flex-start; gap: 14px; }
.coach-seq {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--lime); color: var(--lime);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.coach-ex-info { flex: 1; min-width: 0; }
.coach-ex-info strong { font-size: 16px; display: block; margin-bottom: 4px; }
.coach-ex-info .muted { margin-bottom: 2px; }
.coach-log-btn { flex: 0 0 auto; }
.coach-coachnote { font-size: 14.5px; color: var(--bone); margin-top: 12px; }
.coach-brief {
  margin: 14px 0 4px; padding: 14px 16px; border-radius: 14px;
  background: rgba(214, 255, 56, 0.06); border: 1px solid var(--line);
}
.coach-brief .body { margin: 6px 0 0; font-size: 15px; white-space: pre-line; }
.coach-location { margin-top: 10px; }
.coach-equip {
  margin-top: 12px; font-size: 14.5px;
  border-left: 3px solid var(--blue); background: rgba(80, 140, 255, 0.08);
  padding: 10px 14px; border-radius: 0 10px 10px 0;
}
.coach-safety {
  margin-top: 12px; font-size: 14.5px;
  border-left: 3px solid var(--amber); background: rgba(240, 168, 50, 0.08);
  padding: 10px 14px; border-radius: 0 10px 10px 0;
}
.coach-done { margin-top: 12px; }
.coach-done-mark {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--lime); border: 1px solid var(--lime); border-radius: 999px; padding: 7px 14px;
}

/* ---------- inline actuals form ---------- */
.coach-actuals { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.coach-formgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.coach-formgrid .field { margin-bottom: 16px; }
.coach-formgrid .field label { font-size: 11px; margin-bottom: 8px; }
.coach-formgrid .field input { padding: 12px 14px; font-size: 15px; }

/* ---------- right rail: live signals ---------- */
.coach-signal {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.coach-signal:last-child { border-bottom: none; }
.coach-signal strong { font-size: 15px; text-align: right; }

/* ---------- finish ---------- */
.coach-finish { margin-top: 20px; }
.coach-postform { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 22px; }
.coach-postform .field textarea { min-height: 80px; }
.coach-success {
  border: 1px solid var(--lime); border-radius: 14px; background: rgba(214, 255, 56, 0.07);
  padding: 22px; margin-top: 18px;
}
.coach-success strong { color: var(--lime); font-size: 17px; display: block; margin-bottom: 6px; }

/* ---------- assessment day ---------- */
.coach-assess {
  border: 1px solid var(--line); border-radius: 14px; background: var(--black);
  padding: 20px; margin-top: 16px;
}
.coach-assess strong { font-size: 17px; display: block; margin-bottom: 4px; }
.coach-assess .body { margin-top: 8px; }
.coach-record { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.coach-assess-done { margin: 10px 0; }

/* ---------- rest day list / disclaimer ---------- */
.coach-list { margin: 18px 0 0 20px; color: var(--bone-dim); font-size: 15px; }
.coach-list li { margin-bottom: 8px; }
.coach-disclaimer {
  margin-top: 34px; text-align: center; color: var(--bone-dim); font-size: 13.5px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .coach-layout { grid-template-columns: 1fr; }
  .coach-formgrid { grid-template-columns: 1fr 1fr; }
  .coach-readiness { flex-direction: column; }
  .coach-order { width: 100%; }
}
@media (max-width: 560px) {
  .coach-formgrid { grid-template-columns: 1fr; }
  .coach-ex-top { flex-wrap: wrap; }
  .coach-log-btn { width: 100%; justify-content: center; }
}

/* ---------- per-set capture grid ---------- */
.coach-capture-count { margin: 6px 0 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone-dim); }
.coach-sethead { margin: 0 0 10px; font-size: 14px; color: var(--bone-dim); }
.coach-setgrid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.coach-setrow {
  display: grid;
  grid-template-columns: 34px 52px 1fr 1fr 1.4fr 1fr 1fr;
  gap: 6px; align-items: center;
}
.coach-setrow-head { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone-dim); }
.coach-setrow-head span { padding: 0 2px; }
.sr-n {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); font-size: 13px; color: var(--bone-dim);
}
.sr-donewrap { display: flex; justify-content: center; }
.sr-done { width: 22px; height: 22px; accent-color: var(--lime, #b8e62e); cursor: pointer; }
.coach-setrow input[type="number"],
.coach-setrow input[type="text"] {
  width: 100%; padding: 10px 8px; font-size: 14px;
  background: var(--input-bg, transparent); color: inherit;
  border: 1px solid var(--line); border-radius: 8px;
}
.coach-setrow input::placeholder { color: var(--bone-faint, #8a8a8a); font-size: 12px; }
.coach-addset { margin-bottom: 16px; }
/* Field labels: hidden on desktop (header row shows them), visible on mobile */
.sr-flabel { display: none; }
.sr-field { display: contents; }
@media (max-width: 560px) {
  .coach-setrow-head { display: none; }
  .coach-setrow {
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 4px;
  }
  .sr-n {
    grid-column: 1 / -1;
    justify-self: start;
    margin-bottom: 2px;
  }
  .sr-donewrap {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 0;
  }
  .sr-field { display: flex; flex-direction: column; gap: 3px; }
  .sr-flabel {
    display: block;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--bone-dim);
  }
  .sr-donewrap .sr-flabel { display: inline; font-size: 13px; text-transform: none; letter-spacing: 0; }
}

/* ---------- coach chat ---------- */
.coach-chat { margin-top: 22px; }
.coach-msgs {
  display: flex; flex-direction: column; gap: 12px;
  min-height: 288px; max-height: 520px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin: 14px 0;
}
.coach-msg { max-width: 85%; display: flex; flex-direction: column; }
.coach-msg p { margin: 4px 0 0; font-size: 15px; line-height: 1.5; }
.coach-msg-who { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--bone-dim); margin-bottom: 2px; }
.coach-msg-user { align-self: flex-end; align-items: flex-end; }
.coach-msg-user .coach-msg-who { text-align: right; }
.coach-msg-user p {
  background: var(--lime, #b8e62e); color: #111;
  border-radius: 18px 18px 4px 18px; padding: 10px 16px; display: inline-block; text-align: left;
  font-weight: 500;
}
.coach-msg-coach { align-self: flex-start; align-items: flex-start; }
.coach-msg-coach p {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09); border-radius: 18px 18px 18px 4px; padding: 10px 16px;
}
.coach-chatform { display: flex; gap: 10px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg, #0a0a0f); padding: 8px 0; z-index: 5; }
.coach-chatform textarea {
  flex: 1; padding: 12px 14px; font-size: 15px; line-height: 1.4;
  background: transparent; color: inherit;
  border: 1px solid var(--line); border-radius: 10px;
  min-height: 48px; max-height: 96px; resize: none; overflow-y: auto;
  font-family: inherit;
}
.coach-chatform textarea:focus { outline: 2px solid var(--lime, #b8e62e); outline-offset: -1px; }

/* Notifications tab: lock page in place, no bounce */
.notif-tabs {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg, #0a0a0f);
  padding: 8px 0;
  overscroll-behavior: none;
}
#notifInbox, #notifMessages, #notifBuddies, #notifChallenges, #notifStore {
  overscroll-behavior-y: contain;
}

/* Badge animations: glow for earned, flip on tap */
@keyframes badgeGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(184,230,46,.4)); }
  50% { filter: drop-shadow(0 0 12px rgba(184,230,46,.9)); }
}
.badge-earned img {
  animation: badgeGlow 3s ease-in-out infinite;
  cursor: pointer;
  transition: transform .3s;
}
.badge-earned img:active { transform: scale(1.15) rotateY(180deg); }
.badge-card {
  transition: transform .2s;
}
.badge-card:active { transform: scale(.96); }

/* Mobile responsiveness: Store and Notifications */
@media (max-width: 600px) {
  .notif-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
  }
  .notif-tabs::-webkit-scrollbar { display: none; }
  .notif-tabs .btn {
    flex-shrink: 0;
    min-height: 44px;
    font-size: 13px;
  }
  /* Store category tabs: stable 3-col wrap, no shifting */
  .store-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px;
  }
  .store-tabs .btn {
    flex: 1 1 calc(33.333% - 8px) !important;
    min-height: 44px; font-size: 12px;
    white-space: nowrap;
    flex-shrink: 1 !important;
  }
  /* Store grid: stable 2-col, fixed card heights prevent jumping */
  #storeGrid > div {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  #storeGrid .hub-card {
    min-height: 290px;
    display: flex; flex-direction: column;
    justify-content: space-between;
  }
  #storeGrid .hub-card img {
    height: 72px !important;
    flex-shrink: 0;
    object-fit: contain;
  }
  #gameBadgesSection > div {
    grid-template-columns: 1fr 1fr !important;
  }
  .btn-sm { min-height: 40px; padding: 10px 16px; }
}

/* Badge celebration overlay */
#badgeCelebration {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  animation: celebFadeIn .5s ease-out;
}
@keyframes celebFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes celebPop {
  0% { transform: scale(0) rotate(-180deg); }
  60% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes celebConfetti {
  0% { transform: translateY(-10px) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
.celeb-badge {
  width: min(70vw, 300px); height: min(70vw, 300px);
  animation: celebPop .8s cubic-bezier(.2,1.4,.4,1);
  filter: drop-shadow(0 0 30px rgba(184,230,46,.8));
}
.celeb-title {
  color: var(--lime, #b8e62e);
  font-size: 28px; font-weight: 800;
  margin-top: 24px; text-align: center;
}
.celeb-sub {
  color: #fff; font-size: 16px;
  margin-top: 8px; text-align: center;
  opacity: .8;
}
.celeb-confetti {
  position: absolute; top: -20px;
  width: 10px; height: 10px;
  animation: celebConfetti 3s ease-in forwards;
}

/* Coach chat rich tables */
.coach-table {
  width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px;
}
.coach-table th, .coach-table td {
  border: 1px solid #2a2a2a; padding: 6px 8px; text-align: left;
}
.coach-table th {
  background: rgba(184,230,46,.12); color: var(--lime); font-weight: 700;
}
.coach-table td { color: var(--text); }

/* Wake-up alarm overlay */
#wakeAlarmOverlay {
  position: fixed; inset: 0; z-index: 10000;
  background: radial-gradient(ellipse at center, rgba(184,230,46,.12) 0%, rgba(0,0,0,.97) 70%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  animation: celebFadeIn .5s ease-out;
}
#wakeAlarmOverlay .btn-lime {
  animation: alarmPulse 1.5s ease-in-out infinite;
}
@keyframes alarmPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(184,230,46,.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(184,230,46,.8); }
}

/* Session complete XP celebration */
#xpCelebration {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at center, rgba(184,230,46,.15) 0%, rgba(0,0,0,.95) 70%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  animation: celebFadeIn .5s ease-out;
  overflow: hidden;
}
#xpCelebration::before {
  content: ""; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(184,230,46,.1), transparent, rgba(184,230,46,.08), transparent);
  animation: ambientSpin 8s linear infinite;
}
@keyframes ambientSpin { to { transform: rotate(360deg); } }
.xp-number {
  font-size: min(28vw, 120px);
  font-weight: 900;
  color: var(--lime, #b8e62e);
  text-shadow: 0 0 40px rgba(184,230,46,.6), 0 0 80px rgba(184,230,46,.3);
  line-height: 1;
  z-index: 1;
}
.xp-label {
  font-size: 18px; font-weight: 700;
  color: #fff; letter-spacing: .2em;
  text-transform: uppercase;
  margin-top: 8px; z-index: 1;
}
.xp-breakdown {
  margin-top: 20px; z-index: 1;
  text-align: center;
}
.xp-breakdown p {
  color: rgba(255,255,255,.7);
  font-size: 14px; margin: 4px 0;
}
.xp-breakdown .xp-pts { color: var(--lime, #b8e62e); font-weight: 700; }
#threadInput {
  padding: 12px 14px; font-size: 15px; line-height: 1.4;
  background: transparent; color: inherit;
  border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; overflow-y: auto;
}
#threadInput:focus { outline: 2px solid var(--lime, #b8e62e); outline-offset: -1px; }

/* Chunked coach replies: typing indicator dots */
.coach-typing .tdot {
  display: inline-block; width: 7px; height: 7px; margin-right: 4px;
  border-radius: 50%; background: var(--lime, #d6ff38);
  opacity: .3; animation: coachDot 1.1s ease-in-out infinite;
}
.coach-typing .tdot:nth-child(2) { animation-delay: .18s; }
.coach-typing .tdot:nth-child(3) { animation-delay: .36s; }
@keyframes coachDot {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
