/* ============================================================
   PT Portal — Custom Styles
   ============================================================ */

:root {
  --brand-primary: #0d6efd;
  --brand-dark: #1a1a2e;
  --sidebar-width: 240px;
}

/* ── Body ─────────────────────────────────────────────────── */
body {
  background-color: #141414;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: #e5e7eb;
}

body.login-page {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* ── Login ────────────────────────────────────────────────── */
.login-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #0d6efd, #6610f2);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  margin: 0 auto;
}

/* ── Navbar ───────────────────────────────────────────────── */
.navbar {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-brand {
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  border-radius: 12px;
}

.card-header {
  border-radius: 12px 12px 0 0 !important;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  transition: transform 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
  color: #f3f4f6;
}

.stat-label {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ── Nav Tiles (dashboard) ────────────────────────────────── */
.nav-tile {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.nav-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

/* ── Exercise Cards ───────────────────────────────────────── */
.exercise-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.exercise-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}

/* ── Typography helpers ───────────────────────────────────── */
.x-small {
  font-size: 0.72rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-xs {
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.btn {
  border-radius: 8px;
  font-weight: 500;
}

.btn-lg {
  border-radius: 10px;
}

/* ── Session Type Buttons ─────────────────────────────────── */
.btn-outline-group   { color: #14532d; border-color: #16a34a; }
.btn-outline-1on1    { color: #7c2d12; border-color: #ea580c; }
.btn-outline-virtual { color: #4a1e8c; border-color: #7c3aed; }

.btn-outline-group:hover,
.btn-check:checked + .btn-outline-group   { background: #bbf7d0; color: #14532d; border-color: #16a34a; }
.btn-outline-1on1:hover,
.btn-check:checked + .btn-outline-1on1    { background: #fed7aa; color: #7c2d12; border-color: #ea580c; }
.btn-outline-virtual:hover,
.btn-check:checked + .btn-outline-virtual { background: #e9d5ff; color: #4a1e8c; border-color: #7c3aed; }

/* ── Tables ───────────────────────────────────────────────── */
.table > :not(caption) > * > * {
  padding: 0.6rem 0.75rem;
  vertical-align: middle;
}

/* ── Progress bars ────────────────────────────────────────── */
.progress {
  border-radius: 100px;
  background-color: #e9ecef;
}

.progress-bar {
  border-radius: 100px;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ── Nav Tabs ─────────────────────────────────────────────── */
.nav-tabs .nav-link {
  color: #6c757d;
  border-radius: 8px 8px 0 0;
  font-weight: 500;
  font-size: 0.88rem;
}

.nav-tabs .nav-link.active {
  color: var(--brand-primary);
  font-weight: 600;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px;
  background-color: #1a1a1a;
  border-color: #3a3a3a;
  color: #e5e7eb;
}

.form-control::placeholder { color: #6b7280; }

.form-control:focus, .form-select:focus {
  background-color: #1a1a1a;
  border-color: var(--brand-primary);
  color: #e5e7eb;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label { color: #d1d5db; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-content {
  border-radius: 16px;
  border: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid #f0f0f0;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* ── Calendar ─────────────────────────────────────────────── */
.cal-headers, .cal-grid-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-day-header {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6c757d;
  padding: 6px 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.cal-day {
  min-height: 80px;
  padding: 4px;
  border-right: 1px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.cal-day:hover { background: #f8f9ff; }
.cal-day-empty { min-height: 80px; background: #fafafa; border-right: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.cal-today     { background: #fffaed; }
.cal-today .cal-day-num { color: #0d6efd; font-weight: 700; }

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 2px;
}

.cal-event {
  font-size: 0.62rem;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  display: block;
  line-height: 1.35;
}

.cal-evt-time,
.cal-evt-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-event:hover { opacity: 0.8; }

.cal-event-scheduled { background: #cfe2ff; color: #0a58ca; }
.cal-event-completed  { background: #bfdbfe; color: #1e3a8a; }
.cal-event-cancelled  { background: #e2e3e5; color: #6c757d; }
.cal-event-no_show    { background: #fff3cd; color: #664d03; }
.cal-event-group      { background: #bbf7d0; color: #14532d; }
.cal-event-1on1       { background: #fed7aa; color: #7c2d12; }
.cal-event-virtual    { background: #e9d5ff; color: #4a1e8c; }

.cal-legend {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
}

@media (max-width: 767.98px) {
  .cal-day       { min-height: 70px; padding: 2px; }
  .cal-day-empty { min-height: 70px; }
  .cal-day-num   { font-size: 0.68rem; }
  .cal-event     { font-size: 0.56rem; padding: 1px 2px; margin-bottom: 1px; line-height: 1.3; }
}

/* ── Bottom Nav (mobile admin) ────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #212529;
  display: flex;
  z-index: 1030;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 2px;
  color: #adb5bd;
  text-decoration: none;
  font-size: 0.6rem;
  gap: 2px;
  transition: color 0.15s;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav-item.active {
  color: #0d6efd;
}

.bottom-nav-item:hover {
  color: #fff;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 576px) {
  .stat-value {
    font-size: 1.4rem;
  }
  .stat-icon {
    font-size: 1.5rem;
  }
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (max-width: 767.98px) {
  .btn-sm {
    min-height: 38px;
    min-width: 38px;
  }
  /* Push page content above the fixed bottom nav */
  .has-bottom-nav {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

/* ============================================================
   Phase 2 — Social, Coach, Messaging, Profile
   ============================================================ */

/* ── Feed posts ──────────────────────────────────────────── */
.feed-post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.reaction-btn {
  background: none;
  border: 1px solid #333;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.6;
}

.reaction-btn:hover {
  background: #1e3a5f;
  border-color: #0362CE;
}

.reaction-btn.active {
  background: #0362CE22;
  border-color: #0362CE;
}

/* ── Coach cards ─────────────────────────────────────────── */
.coach-card {
  transition: transform .15s, box-shadow .15s;
}

.coach-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.25) !important;
}

.coach-card .star-rating {
  color: #fbbf24;
  font-size: 0.88rem;
}

/* ── Message bubbles ─────────────────────────────────────── */
.msg-bubble {
  max-width: 72%;
  padding: .55rem .9rem;
  border-radius: 18px;
  font-size: .88rem;
  line-height: 1.45;
  word-break: break-word;
}

.msg-mine {
  background: #0362CE;
  color: #fff;
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.msg-theirs {
  background: #2a2a2a;
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: .65rem;
  color: #666;
  margin-top: 2px;
}

/* ── Profile avatar (large) ──────────────────────────────── */
.profile-avatar-lg {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ── Unread message badge on nav icon ────────────────────── */
.nav-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #dc3545;
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* ── Thread list scrollbar ───────────────────────────────── */
#threadList::-webkit-scrollbar,
#messageList::-webkit-scrollbar {
  width: 4px;
}
#threadList::-webkit-scrollbar-thumb,
#messageList::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

/* ============================================================
   Global Dark Theme Overrides
   ============================================================ */

/* Cards */
.card {
  background-color: #1e1e1e;
  border-color: #2a2a2a;
  color: #e5e7eb;
}

.card-header {
  background-color: #252525 !important;
  border-bottom-color: #2a2a2a;
  color: #f3f4f6;
}

.card-footer {
  background-color: #252525;
  border-top-color: #2a2a2a;
}

/* Nav tiles — fix text-dark label on dark card */
.nav-tile { background-color: #1e1e1e; }
.nav-tile .text-dark,
.nav-tile .fw-semibold,
.nav-tile .small { color: #d1d5db !important; }

/* List groups */
.list-group-item {
  background-color: transparent;
  border-color: #2a2a2a;
  color: #e5e7eb;
}
.list-group-item:hover { background-color: #252525; }
.list-group-item + .list-group-item { border-top-width: 1px; }

/* Tables */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: #e5e7eb;
  --bs-table-border-color: #2a2a2a;
  --bs-table-striped-bg: rgba(255,255,255,.025);
  --bs-table-hover-bg: rgba(255,255,255,.04);
  --bs-table-active-bg: rgba(255,255,255,.05);
}
.table-light {
  --bs-table-bg: #252525;
  --bs-table-color: #9ca3af;
  --bs-table-border-color: #2a2a2a;
}
.table th { color: #9ca3af; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

/* Modals */
.modal-content {
  background-color: #1e1e1e;
  color: #e5e7eb;
}
.modal-header  { border-bottom-color: #2a2a2a; color: #f3f4f6; }
.modal-footer  { border-top-color: #2a2a2a; }
.modal-title   { color: #f3f4f6; }
.btn-close     { filter: invert(1) grayscale(100%) brightness(200%); }

/* Input groups */
.input-group-text {
  background-color: #252525;
  border-color: #3a3a3a;
  color: #9ca3af;
}

/* Progress bar track */
.progress { background-color: #2a2a2a; }

/* Alerts */
.alert-danger  { background-color: #2d1515; border-color: #5a2020; color: #f87171; }
.alert-success { background-color: #152d1a; border-color: #1e4d2a; color: #4ade80; }
.alert-warning { background-color: #2d2415; border-color: #4d3a1e; color: #fbbf24; }
.alert-info    { background-color: #15252d; border-color: #1e3f4d; color: #38bdf8; }

/* Dropdowns */
.dropdown-menu        { background-color: #252525; border-color: #3a3a3a; }
.dropdown-item        { color: #e5e7eb; }
.dropdown-item:hover,
.dropdown-item:focus  { background-color: #2a2a2a; color: #fff; }
.dropdown-divider     { border-top-color: #3a3a3a; }

/* Pagination */
.page-link                    { background-color: #1e1e1e; border-color: #2a2a2a; color: #9ca3af; }
.page-link:hover              { background-color: #252525; color: #e5e7eb; border-color: #3a3a3a; }
.page-item.active .page-link  { background-color: #0362CE; border-color: #0362CE; }
.page-item.disabled .page-link{ background-color: #1e1e1e; color: #4b5563; }

/* Badges (subtle variants on dark bg) */
.bg-success-subtle { background-color: #152d1a !important; }
.text-success      { color: #4ade80 !important; }
.bg-danger-subtle  { background-color: #2d1515 !important; }
.text-danger       { color: #f87171 !important; }
.bg-warning-subtle { background-color: #2d2415 !important; }
.bg-info-subtle    { background-color: #15252d !important; }
.text-muted        { color: #9ca3af !important; }

/* Calendar dark overrides */
.cal-day        { border-color: #2a2a2a; background: #1e1e1e; }
.cal-day:hover  { background: #252525; }
.cal-day-empty  { background: #191919; border-color: #2a2a2a; }
.cal-today      { background: #1a2340 !important; }
.cal-day-num    { color: #d1d5db; }

/* Scrollbar dark */
::-webkit-scrollbar-track { background: #1e1e1e; }

/* Stat card link — remove underline/color change on hover */
a.text-decoration-none .stat-card { color: inherit; }
a.text-decoration-none:hover .stat-card { transform: translateY(-3px); }
