/* ── CSS Custom Properties ────────────────────────────────────────────────── */
:root {
  /* Brand */
  --pp-primary:       #0BA899;
  --pp-primary-dk:    #0D9488;
  --pp-primary-lt:    #CCFBF1;
  --pp-accent:        #F97316;
  --pp-accent-lt:     #FFF7ED;
  --pp-dark:          #0D3D39;
  --pp-dark-mid:      #134E4A;

  /* Surfaces */
  --pp-surface:       #F4FFFE;
  --pp-surface-2:     #FFFFFF;

  /* Text */
  --pp-text:          #0B1F1E;
  --pp-text-muted:    #5E7470;

  /* Status */
  --pp-on-court:      #10B981;
  --pp-on-deck:       #F59E0B;
  --pp-waiting:       #94A3B8;

  /* Bootstrap overrides */
  --bs-primary:       #0BA899;
  --bs-primary-rgb:   11, 168, 153;
  --bs-success:       #10B981;
  --bs-success-rgb:   16, 185, 129;
  --bs-warning:       #F59E0B;
  --bs-warning-rgb:   245, 158, 11;
  --bs-danger:        #EF4444;
  --bs-danger-rgb:    239, 68, 68;
  --bs-body-bg:       #F4FFFE;
  --bs-body-color:    #0B1F1E;
  --bs-link-color:    #0BA899;
}

/* ── Base typography ─────────────────────────────────────────────────────── */
html {
  font-size: 16px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--pp-surface);
  color: var(--pp-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main[role="main"] {
  flex: 1 0 auto;
}

/* login page is a standalone template — undo body flex there */
body.login-page {
  display: block;
  min-height: unset;
}

h1, h2, h3, h4, h5, h6,
.score-display, .stat-number {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

/* ── Focus ring (accessibility) ─────────────────────────────────────────── */
.btn:focus, .btn:active:focus,
.form-control:focus, .form-check-input:focus,
.form-select:focus {
  box-shadow: 0 0 0 0.15rem rgba(13, 148, 136, 0.4);
}

/* ── Score display ───────────────────────────────────────────────────────── */
.score-display {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  min-width: 2.5ch;
  text-align: center;
  color: var(--pp-text);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--pp-text);
}

/* ── Score pad buttons ───────────────────────────────────────────────────── */
.score-btn {
  min-width: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Live indicator ──────────────────────────────────────────────────────── */
.live-indicator {
  color: #EF4444;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #EF4444;
  animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

/* ── Player status badge ─────────────────────────────────────────────────── */
.status-badge {
  font-family: 'Poppins', system-ui, sans-serif;
  letter-spacing: 0.05em;
}

/* ── Utility: constrain readable text ───────────────────────────────────── */
.text-readable {
  max-width: 65ch;
}

/* ── Bootstrap primary colour override ──────────────────────────────────── */
.btn-primary {
  --bs-btn-bg: var(--pp-primary);
  --bs-btn-border-color: var(--pp-primary);
  --bs-btn-hover-bg: var(--pp-primary-dk);
  --bs-btn-hover-border-color: var(--pp-primary-dk);
  --bs-btn-active-bg: var(--pp-primary-dk);
}

.btn-outline-primary {
  --bs-btn-color: var(--pp-primary);
  --bs-btn-border-color: var(--pp-primary);
  --bs-btn-hover-bg: var(--pp-primary);
  --bs-btn-hover-border-color: var(--pp-primary);
}

/* ── Nav pills — use brand teal for active state ────────────────────────── */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background-color: var(--pp-primary);
  border-color: var(--pp-primary);
  color: #fff;
}
.nav-pills .nav-link {
  color: var(--pp-primary-dk);
}
.nav-pills .nav-link:hover:not(.active) {
  background-color: var(--pp-primary-lt);
  color: var(--pp-primary-dk);
}

/* ── Score entry animation ───────────────────────────────────────────────── */
@keyframes score-bump {
  0%   { transform: scale(1);    }
  40%  { transform: scale(1.25); }
  100% { transform: scale(1);    }
}

.score-bump {
  animation: score-bump 0.25s ease-out;
}

}

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  margin: 0;
  padding: 0;
  background: #fff;
}

.login-split {
  display: flex;
  min-height: 100vh;
}

/* Left: dark brand panel */
.login-panel-brand {
  flex: 0 0 44%;
  background: linear-gradient(155deg, #071f1d 0%, var(--pp-dark) 50%, var(--pp-dark-mid) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.5rem;
  position: relative;
  overflow: hidden;
}

/* Decorative rings for depth */
.login-panel-brand::before,
.login-panel-brand::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-panel-brand::before {
  top: -130px;
  right: -130px;
  width: 420px;
  height: 420px;
  border: 1.5px solid rgba(255,255,255,0.07);
}
.login-panel-brand::after {
  bottom: -90px;
  left: -90px;
  width: 320px;
  height: 320px;
  border: 1.5px solid rgba(255,255,255,0.05);
}

.login-brand-inner {
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  margin-bottom: 2.5rem;
}

.login-logo-wordmark {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.login-brand-heading {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.login-brand-sub {
  color: rgba(255,255,255,0.65);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 36ch;
  margin-bottom: 0;
}

.login-features {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.login-features li {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.login-feature-icon {
  color: var(--pp-accent);
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.login-features li strong {
  display: block;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600;
  color: #ffffff;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.login-features li span {
  color: rgba(255,255,255,0.6);
  font-size: 0.83rem;
  line-height: 1.55;
}

.login-brand-copy {
  position: relative;
  z-index: 1;
  color: rgba(255,255,255,0.35);
  font-size: 0.78rem;
  margin: 0;
}

/* Right: form panel */
.login-panel-form {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: #ffffff;
}

.login-form-inner {
  width: 100%;
  max-width: 400px;
}

.login-welcome-heading {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--pp-dark);
  margin-bottom: 0.25rem;
}

.login-welcome-sub {
  color: var(--pp-text-muted);
  font-size: 0.95rem;
}

.login-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pp-text-muted);
  margin-bottom: 0.4rem;
}

.login-input-wrap {
  position: relative;
}

.login-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pp-text-muted);
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 2;
}

.login-input {
  padding-left: 2.5rem !important;
  border: 1px solid #D1D9D8;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  height: 48px;
  background-color: #F5FAF9;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
  border-color: var(--pp-primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 0.15rem rgba(11, 168, 153, 0.2);
  outline: none;
}

.login-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pp-dark);
  color: #ffffff;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background-color 0.15s, transform 0.1s;
}

.login-submit-btn:hover {
  background: var(--pp-primary-dk);
  color: #ffffff;
}

.login-submit-btn:active {
  transform: translateY(1px);
}

.login-register-link {
  color: var(--pp-primary);
  text-decoration: none;
}

.login-register-link:hover {
  color: var(--pp-primary-dk);
  text-decoration: underline;
}

/* ── Login responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-split {
    flex-direction: column;
  }

  .login-panel-brand {
    flex: none;
    padding: 2rem 1.75rem 2.25rem;
  }

  .login-features,
  .login-brand-sub {
    display: none;
  }

  .login-brand-heading {
    font-size: 1.8rem;
  }
}

/* ── Page hero ───────────────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--pp-dark) 0%, var(--pp-dark-mid) 100%);
  padding: 3.5rem 0;
  position: relative;
  overflow: hidden;
}

/* ── Compact events page header ─────────────────────────────────────────── */
.events-page-header {
  background: linear-gradient(135deg, var(--pp-dark) 0%, var(--pp-dark-mid) 100%);
  padding: 0.9rem 0 1rem;
}

/* ── My-event card tints ─────────────────────────────────────────────────── */
.card-mine-organiser {
  border-left: 4px solid var(--pp-primary-dk) !important;
  background-color: rgba(13,148,136,0.05) !important;
}
.card-mine-registered {
  border-left: 4px solid #10B981 !important;
  background-color: rgba(16,185,129,0.05) !important;
}
.card-mine-pending {
  border-left: 4px solid #F59E0B !important;
  background-color: rgba(245,158,11,0.05) !important;
}

/* ── Global spinner overlay ───────────────────────────────────────────────── */
#pp-spinner-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}
#pp-spinner-overlay.active {
  display: flex;
}
#pp-spinner-overlay .spinner-border {
  width: 3rem;
  height: 3rem;
  color: #fff;
}
#pp-spinner-dismiss {
  display: none;
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
}



.page-hero::after {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06);
  pointer-events: none;
}

.page-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pp-primary);
  background: rgba(11, 168, 153, 0.18);
  border-radius: 20px;
  padding: 0.25rem 0.8rem;
  margin-bottom: 0.75rem;
}

.page-hero-title {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.page-hero-sub {
  color: rgba(255,255,255,0.65);
  font-size: 0.97rem;
  max-width: 58ch;
  line-height: 1.7;
  margin-bottom: 0;
}

.page-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: rgba(255,255,255,0.65);
  font-size: 0.78rem;
  font-weight: 400;
  padding: 0;
}

/* ── Section headings ────────────────────────────────────────────────────── */
.section-heading {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--pp-dark);
  display: flex;
  align-items: center;
}

/* ── Accent button ───────────────────────────────────────────────────────── */
.btn-accent {
  background-color: var(--pp-accent);
  border-color: var(--pp-accent);
  color: #ffffff;
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600;
}

.btn-accent:hover {
  background-color: #e8670a;
  border-color: #e8670a;
  color: #ffffff;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--pp-surface-2);
  border-radius: 1rem;
  border: 1px dashed #C8D8D6;
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--pp-primary-lt);
  font-size: 2rem;
  color: var(--pp-primary);
  margin-bottom: 1.25rem;
}

.empty-state-heading {
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--pp-dark);
  margin-bottom: 0.5rem;
}

.empty-state-sub {
  color: var(--pp-text-muted);
  font-size: 0.88rem;
  max-width: 46ch;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Leaderboard table ───────────────────────────────────────────────────── */
.leaderboard-table-wrap {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #DDE8E6;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.leaderboard-table {
  margin-bottom: 0;
}

.leaderboard-table thead th {
  background: var(--pp-dark);
  color: rgba(255,255,255,0.65);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  border: none;
  padding: 0.85rem 1rem;
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid #EEF4F3;
  transition: background-color 0.1s;
}

.leaderboard-table tbody tr:last-child {
  border-bottom: none;
}

.leaderboard-table tbody tr.leaderboard-top3 {
  background: #F4FFFE;
}

.leaderboard-table tbody tr:hover {
  background: #EEF9F7;
}

.leaderboard-table td {
  padding: 0.9rem 1rem;
  vertical-align: middle;
}

.rank-col {
  width: 56px;
  text-align: center;
}

.rank-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #EEF4F3;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--pp-text-muted);
}

.stat-pill {
  display: inline-block;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
}

.stat-pill--wins {
  background: #D1FAE5;
  color: #065F46;
}

.stat-pill--losses {
  background: #FEE2E2;
  color: #991B1B;
}

.win-pct-bar-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 80px;
}

.win-pct-fill {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  background: var(--pp-primary);
  min-width: 4px;
  max-width: 60px;
  flex-shrink: 0;
}

.win-pct-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pp-text);
  white-space: nowrap;
}

/* ── Podium ──────────────────────────────────────────────────────────────── */
.podium-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1rem;
}

.podium-card {
  flex: 0 1 175px;
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.25rem 1rem;
  text-align: center;
  border: 1px solid #DDE8E6;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: relative;
}

.podium-top {
  transform: translateY(-18px);
  box-shadow: 0 8px 28px rgba(11,168,153,0.18);
  border-color: var(--pp-primary);
}

.podium-crown {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.4rem;
  color: #F59E0B;
}

.podium-rank {
  font-family: 'Poppins', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 0.5rem;
}

.podium-gold .podium-rank   { color: #B45309; }
.podium-silver .podium-rank { color: #475569; }
.podium-bronze .podium-rank { color: #92400E; }

.podium-avatar {
  font-size: 2.5rem;
  color: #C8D8D6;
  margin-bottom: 0.4rem;
}

.podium-gold .podium-avatar { color: #F59E0B; }

.podium-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--pp-dark);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-stat {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--pp-primary);
}

/* ── Event cards ────────────────────────────────────────────────────────── */
.event-card-link { display: block; }
.event-card {
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.event-card-hint {
  opacity: 0;
  transition: opacity 0.18s ease;
  white-space: nowrap;
}
.event-card-link:hover .event-card {
  box-shadow: 0 8px 28px rgba(0,0,0,0.14) !important;
  transform: translateY(-3px);
}
.event-card-link:hover .event-card-hint {
  opacity: 1;
}
/* legacy class kept for other pages */
.hover-shadow {
  transition: box-shadow 0.15s, transform 0.15s;
}
.hover-shadow:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
  transform: translateY(-2px);
}
/* ── Events header toggle ──────────────────────────────────────────────── */
.event-types-toggle {
  color: rgba(255,255,255,0.65) !important;
  font-size: 0.8rem;
  text-decoration: none !important;
}
.event-types-toggle:hover {
  color: #fff !important;
}

/* ── Responsive adjustments ──────────────────────────────────────────────── */
@media (max-width: 576px) {
  .page-hero { padding: 2.5rem 0; }
  .page-hero-title { font-size: 1.8rem; }
  .podium-card { flex: 0 1 100px; padding: 0.75rem 0.5rem; }
  .podium-avatar { font-size: 1.75rem; }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.rotate-180 {
  transform: rotate(180deg);
  transition: transform 0.2s ease;
}

.adv-chevron {
  transition: transform 0.2s ease;
  display: inline-block;
}
/* -- Bottom mobile nav ---------------------------------------------------- */
@media (max-width: 991.98px) {
  body {
    padding-bottom: 68px;
  }
}

.pp-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  background: var(--pp-dark);
  border-top: 1px solid rgba(255,255,255,.1);
  justify-content: space-around;
  align-items: flex-start;
  z-index: 1040;
  padding: 0 4px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}

.pp-bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  min-height: 64px;
  text-decoration: none;
  color: rgba(255,255,255,.45) !important;
  font-size: .56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 6px 4px;
  border-radius: 0;
  transition: color .15s;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}

.pp-bn-item i {
  font-size: 1.2rem;
  line-height: 1;
}

.pp-bn-item:hover,
.pp-bn-item.active {
  color: #ffffff !important;
}

.pp-bn-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: .55rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--pp-dark);
}
