/* BinaryFit Gym: theme on top of Bootstrap 5.3 */
:root {
  --brand: #4338ca;
  --brand-rgb: 67, 56, 202;
  --brand-dark: #312e81;
  --brand-soft: #eef2ff;
  --accent: #10b981;
  --page-bg: #f6f7fb;
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--brand-dark);
  --bs-border-radius: 0.6rem;
  --bs-border-radius-lg: 0.9rem;
}

body {
  background: var(--page-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}
.text-brand { color: var(--brand) !important; }
.bg-brand-soft { background: var(--brand-soft) !important; }
.form-control:focus, .form-select:focus {
  border-color: rgba(var(--brand-rgb), 0.5);
  box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.15);
}

/* ---- Navigation ---------------------------------------------------- */
.app-nav {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
}
.app-nav .navbar-brand { font-weight: 700; letter-spacing: 0.2px; }
.app-nav .nav-link { color: rgba(255, 255, 255, 0.78); border-radius: 0.5rem; padding-inline: 0.75rem !important; }
.app-nav .nav-link:hover { color: #fff; }
.app-nav .nav-link.active { color: #fff; background: rgba(255, 255, 255, 0.14); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.16);
  margin-right: 0.5rem;
}
.role-pill {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

/* ---- Cards & tiles ----------------------------------------------------- */
.card { border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08); }
.card-header { background: transparent; border-bottom: 1px solid rgba(0, 0, 0, 0.06); font-weight: 600; }
.page-title { font-weight: 700; letter-spacing: -0.01em; }
.page-subtitle { color: var(--bs-secondary-color); }

.kpi { padding: 1.1rem 1.2rem; }
.kpi .kpi-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi .kpi-label { color: var(--bs-secondary-color); font-size: 0.85rem; }

.membership-card {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand) 60%, #6366f1);
  color: #fff;
}
.membership-card .text-muted-light { color: rgba(255, 255, 255, 0.72); }
.membership-card .progress { background: rgba(255, 255, 255, 0.2); height: 0.55rem; }
.membership-card .progress-bar { background: #a7f3d0; }

/* ---- Lists & tables ---------------------------------------------------- */
.table > :not(caption) > * > * { padding: 0.65rem 0.75rem; }
.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
  font-weight: 600;
  white-space: nowrap;
}
.table-hover tbody tr.clickable { cursor: pointer; }
.session-item { border-left: 4px solid var(--brand); }
.session-item.status-completed { border-left-color: var(--bs-success); }
.session-item.status-no_show { border-left-color: var(--bs-warning); }
.session-item.status-cancelled { border-left-color: var(--bs-secondary); opacity: 0.75; }
.date-chip {
  min-width: 3.4rem;
  text-align: center;
  border-radius: 0.6rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 0.35rem 0.4rem;
  line-height: 1.1;
}
.date-chip .day { font-size: 1.25rem; font-weight: 700; }
.date-chip .mon { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- Booking ------------------------------------------------------------ */
.trainer-option { cursor: pointer; transition: transform 0.1s ease, box-shadow 0.1s ease; }
.trainer-option:hover { transform: translateY(-2px); }
.trainer-option.selected { outline: 2px solid var(--brand); }
.avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.2rem, 1fr)); gap: 0.5rem; }
.slot-grid .btn { font-variant-numeric: tabular-nums; }
.slot-grid .btn.unavailable { text-decoration: line-through; }

/* ---- Availability editor ---------------------------------------------- */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.75rem; }
@media (max-width: 991.98px) { .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .week-grid { grid-template-columns: 1fr; } }
.window-chip {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 0.5rem;
  padding: 0.35rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

/* ---- Landing ------------------------------------------------------------ */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(16, 185, 129, 0.25), transparent),
    linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
}
.hero .lead { color: rgba(255, 255, 255, 0.82); }
.plan-card .price { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.plan-card.featured { outline: 2px solid var(--brand); }
.auth-card { max-width: 460px; }

.empty-state { color: var(--bs-secondary-color); text-align: center; padding: 2rem 1rem; }
.empty-state i { font-size: 2rem; display: block; margin-bottom: 0.5rem; opacity: 0.6; }

.chart-box { position: relative; height: 280px; }
footer.app-footer { color: var(--bs-secondary-color); font-size: 0.85rem; }
.font-tabular { font-variant-numeric: tabular-nums; }

/* ---- Sign-up wizard -------------------------------------------------- */
.wizard-card { max-width: 760px; }
.wizard-steps { display: flex; gap: 0.5rem; list-style: none; padding: 0; counter-reset: none; }
.wizard-steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--bs-secondary-color);
  padding-bottom: 0.6rem;
  border-bottom: 3px solid #e5e7f0;
}
.wizard-steps li span {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  background: #e5e7f0;
  color: var(--bs-secondary-color);
}
.wizard-steps li.active { color: var(--brand-dark); font-weight: 600; border-bottom-color: var(--brand); }
.wizard-steps li.active span { background: var(--brand); color: #fff; }
.wizard-steps li.done { color: var(--brand-dark); border-bottom-color: var(--accent); }
.wizard-steps li.done span { background: var(--accent); color: #fff; }
.plan-choice { cursor: pointer; border: 2px solid transparent; transition: border-color 0.1s ease; }
.plan-choice:hover { border-color: rgba(var(--brand-rgb), 0.35); }
.plan-choice.selected { border-color: var(--brand); background: var(--brand-soft); }

/* ---- Page transitions and "Payment complete" ---------------------------- */
/* `backwards`, not `both`: a filled transform/opacity after the animation
   would keep a stacking context on <main>, trapping in-page modals under
   Bootstrap's backdrop (which lives on <body>), so they could not be clicked. */
main { animation: page-in 0.45s ease-out backwards; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
body.page-leave main,
body.page-leave .pay-success-card {
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.pay-success {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(30, 27, 75, 0.45);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.pay-success.show { opacity: 1; }
.pay-success-card {
  width: 420px;
  max-width: 100%;
  background: #fff;
  border-radius: 1.25rem;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 24px 60px rgba(30, 27, 75, 0.25);
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.pay-success.show .pay-success-card { transform: scale(1); }
.pay-check { width: 96px; height: 96px; display: block; margin: 0 auto; animation: pay-pop 0.45s ease-out 0.95s both; }
.pay-check-circle {
  stroke: #10b981;
  stroke-width: 3;
  fill: rgba(16, 185, 129, 0.08);
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: pay-stroke 0.6s ease-out 0.15s forwards;
}
.pay-check-mark {
  stroke: #10b981;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: pay-stroke 0.35s ease-out 0.7s forwards;
}
@keyframes pay-stroke { to { stroke-dashoffset: 0; } }
@keyframes pay-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.pay-success .pay-amount { color: #047857; }

@media (prefers-reduced-motion: reduce) {
  main, .pay-check, .pay-check-circle, .pay-check-mark { animation-duration: 0.01s; animation-delay: 0s; }
  .pay-success, .pay-success-card, body.page-leave main { transition: none; }
}

/* Booking page: the trainer list scrolls on its own, not with the page */
.trainer-list { max-height: calc(100vh - 290px); min-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 991.98px) { .trainer-list { max-height: 360px; } }

/* =====================================================================
   Social area: X-style feed, Instagram-style profiles
   ===================================================================== */
:root { --like: #f91880; --ring: linear-gradient(45deg, #f58529, #dd2a7b 45%, #8134af 75%, #515bd4); }

.avatar-sm { width: 2rem; height: 2rem; font-size: 0.8rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.25rem; }
.avatar-xl { width: 8rem; height: 8rem; font-size: 2.75rem; }
.story-ring { display: inline-block; padding: 3px; border-radius: 50%; background: var(--ring); }
.story-ring > .avatar { border: 3px solid #fff; }

.social-col-sticky { position: sticky; top: 5.5rem; }
.feed-card { border-radius: 1rem; overflow: hidden; }
.feed-divider {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1.1rem; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark);
  border-top: 1px solid rgba(0, 0, 0, 0.06); border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.feed-divider .sub { font-weight: 400; color: var(--bs-secondary-color); font-size: 0.85rem; }

/* Composer */
.composer textarea { border: 0; resize: none; font-size: 1.15rem; padding: 0.4rem 0; box-shadow: none !important; min-height: 3rem; }
.composer textarea::placeholder { color: #8b8fa3; }
.char-ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.char-ring circle { fill: none; stroke-width: 3; }
.char-ring .track { stroke: #e7e9f2; }
.char-ring .meter { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 0.15s ease, stroke 0.15s ease; }
.char-ring.warn .meter { stroke: #f59e0b; }
.char-ring.over .meter { stroke: #dc2626; }
.char-left { font-size: 0.8rem; min-width: 1.5rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Posts */
.post { padding: 0.9rem 1.1rem; border-bottom: 1px solid rgba(0, 0, 0, 0.06); transition: background 0.15s ease; }
.post:hover { background: #fafbff; }
.post.post-new { animation: post-in 0.45s ease-out; }
@keyframes post-in { from { background: var(--brand-soft); transform: translateY(-6px); opacity: 0; } to { opacity: 1; transform: none; } }
.post-reason { font-size: 0.8rem; color: var(--bs-secondary-color); margin: 0 0 0.35rem 3.4rem; font-weight: 600; }
.post-head { display: flex; align-items: baseline; gap: 0.35rem; flex-wrap: wrap; line-height: 1.3; }
.post-head a { color: inherit; text-decoration: none; }
.post-head a.name:hover { text-decoration: underline; }
.post-body { white-space: pre-wrap; word-wrap: break-word; font-size: 1rem; margin: 0.15rem 0 0.4rem; }
.post-body a { color: var(--brand); text-decoration: none; font-weight: 500; }
.post-body a:hover { text-decoration: underline; }
.verified { color: var(--brand); font-size: 0.9rem; }

.post-actions { display: flex; gap: 2.5rem; margin-left: -0.5rem; }
.pa {
  display: inline-flex; align-items: center; gap: 0.35rem; border: 0; background: none;
  color: #6b7280; padding: 0.25rem 0.5rem; border-radius: 999px; font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.pa i { font-size: 1.05rem; }
.pa:hover { background: var(--brand-soft); color: var(--brand); }
.pa-like:hover { background: rgba(249, 24, 128, 0.1); color: var(--like); }
.pa-like.liked { color: var(--like); }
.pa-like.pop i { animation: like-pop 0.4s ease-out; }
@keyframes like-pop { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 70% { transform: scale(0.9); } 100% { transform: scale(1); } }

.post-comments { margin-top: 0.6rem; border-left: 2px solid #eceef6; padding-left: 0.9rem; }
.comment { display: flex; gap: 0.6rem; padding: 0.4rem 0; }
.comment .body { white-space: pre-wrap; word-wrap: break-word; }

/* People */
.person-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem; text-decoration: none; color: inherit; }
.person-row:hover { background: #fafbff; }
.person-row .who { flex: 1; min-width: 0; line-height: 1.25; }
.person-row .who .handle { color: var(--bs-secondary-color); font-size: 0.85rem; }
.person-row .who .why { color: var(--bs-secondary-color); font-size: 0.78rem; }
.btn-follow { border-radius: 999px; font-weight: 600; min-width: 5.6rem; white-space: nowrap; flex-shrink: 0; }
.btn-follow.following { background: #fff; color: var(--bs-body-color); border: 1px solid #d0d3e0; }
.btn-follow.following:hover { color: #dc2626; border-color: #fca5a5; background: #fff5f5; }
.badge-follows-you { background: #eef0f6; color: #4b5068; font-weight: 500; }

.search-wrap { position: relative; }
.search-pill .form-control, .search-pill .input-group-text { background: #eef0f6; border: 0; }
.search-pill .input-group-text { border-radius: 999px 0 0 999px; }
.search-pill .form-control { border-radius: 0 999px 999px 0; }
.search-pill .form-control:focus { background: #fff; box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.35); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1030;
  background: #fff; border-radius: 0.9rem; box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16); max-height: 420px; overflow-y: auto;
}

.tag-chip { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 0.85rem; text-decoration: none; }
.tag-chip:hover { background: #e0e4ff; }
.trend-row { display: block; padding: 0.55rem 1rem; text-decoration: none; color: inherit; }
.trend-row:hover { background: #fafbff; }

/* Instagram-style profile header */
.profile-head { display: flex; gap: 2.5rem; align-items: center; padding: 1.5rem 0.5rem; }
.profile-head .handle { font-size: 1.4rem; font-weight: 400; }
.profile-stats { display: flex; gap: 2rem; }
.profile-stats button { border: 0; background: none; padding: 0; color: inherit; }
.profile-stats b { font-weight: 700; }
@media (max-width: 575.98px) {
  .profile-head { gap: 1.25rem; }
  .avatar-xl { width: 5.5rem; height: 5.5rem; font-size: 1.9rem; }
  .profile-stats { gap: 1rem; font-size: 0.9rem; }
  .post-actions { gap: 1.5rem; }
}

/* Live username check (sign-up, profile settings) */
.username-field .input-group-text { font-weight: 600; color: var(--bs-secondary-color); }
.username-status { font-size: 0.85rem; min-height: 1.3rem; margin-top: 0.3rem; }
.username-status .ok { color: #047857; }
.username-status .bad { color: #b42318; }
.username-suggestion { border: 0; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 0.1rem 0.6rem; margin: 0.2rem 0.25rem 0 0; font-size: 0.8rem; }
