html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background-color: #f5f7fa;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Derby Title */
.derby-title {
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1a1a2e;
}

/* Group Card */
.group-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* Group Header */
.group-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  padding: 1rem 1.25rem;
}

.group-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.group-description {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Group Body */
.group-body {
  padding: 0;
}

.group-table-header {
  display: flex;
  padding: 0.6rem 1.25rem;
  background: #f8f9fb;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
}

/* Player Row */
.player-row {
  display: flex;
  padding: 0.55rem 1.25rem;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
  transition: background-color 0.15s ease;
}

.player-row:last-child {
  border-bottom: none;
}

.player-row:hover {
  background-color: #f8f9fb;
}

/* Columns */
.col-player {
  flex: 1;
  min-width: 0;
}

.col-hr {
  width: 50px;
  text-align: center;
  font-weight: 600;
  color: #1a1a2e;
}

.player-name {
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
}

.player-team {
  font-size: 0.75rem;
  color: #999;
  margin-left: 0.35rem;
  font-weight: 500;
}

/* Player Clickable */
.player-clickable {
  cursor: pointer;
}

/* Player Card Popup Overlay */
.player-card-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.player-card-popup {
  background: #fff;
  border-radius: 16px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
  animation: popupSlideIn 0.2s ease-out;
}

@keyframes popupSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.player-card-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1;
  line-height: 1;
}

.player-card-close:hover {
  color: #fff;
}

.player-card-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  padding: 1.5rem;
  text-align: center;
}

.player-card-name {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 1.3rem;
}

.player-card-team-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.player-card-stats {
  padding: 0;
}

/* Highlight Stats Row */
.stat-row-highlight {
  display: flex;
  justify-content: space-around;
  padding: 1.25rem 1rem;
  background: #f8f9fb;
  border-bottom: 1px solid #e9ecef;
}

.stat-item-big {
  text-align: center;
}

.stat-value-big {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* Stats Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 1rem;
  gap: 0;
}

.stat-grid-item {
  text-align: center;
  padding: 0.6rem 0.25rem;
  border-bottom: 1px solid #f0f0f0;
}

.stat-grid-item:nth-last-child(-n+5) {
  border-bottom: none;
}

.stat-grid-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #999;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.stat-grid-value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin-top: 0.15rem;
}

/* Team Total HR Footer */
.team-total-hr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.team-total-hr-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ff6b6b;
}

/* Leader Banner */
.leader-banner {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.leader-banner-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.leader-crown {
  font-size: 2rem;
  line-height: 1;
}

.leader-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.leader-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.leader-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.leader-hr {
  text-align: center;
}

.leader-hr-value {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: #ff6b6b;
  line-height: 1.1;
}

.leader-hr-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

/* Admin styles */
.player-filter {
  margin-bottom: 0.5rem;
}

/* ── Theme Toggle Button ── */
.theme-toggle-btn {
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.theme-toggle-btn:hover {
  opacity: 1;
}

/* ── Dark Mode Overrides ── */
[data-bs-theme="dark"] body {
  background-color: #0f1117;
}

[data-bs-theme="dark"] .navbar {
  background-color: #1a1d27 !important;
  border-color: #2d3147 !important;
}

[data-bs-theme="dark"] .navbar-brand,
[data-bs-theme="dark"] .nav-link.text-dark {
  color: rgba(255, 255, 255, 0.85) !important;
}

[data-bs-theme="dark"] .nav-link.text-dark:hover {
  color: #fff !important;
}

[data-bs-theme="dark"] .derby-title {
  color: #e0e6ff;
}

[data-bs-theme="dark"] .group-card {
  background: #1e2130;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .group-table-header {
  background: #252836;
  border-color: #2d3147;
  color: #8a8fa8;
}

[data-bs-theme="dark"] .player-row {
  border-color: #2d3147;
}

[data-bs-theme="dark"] .player-row:hover {
  background-color: #252836;
}

[data-bs-theme="dark"] .player-name {
  color: #d0d4e8;
}

[data-bs-theme="dark"] .player-team {
  color: #6b7194;
}

[data-bs-theme="dark"] .col-hr {
  color: #d0d4e8;
}

[data-bs-theme="dark"] .stat-row-highlight {
  background: #252836;
  border-color: #2d3147;
}

[data-bs-theme="dark"] .stat-value-big {
  color: #e0e6ff;
}

[data-bs-theme="dark"] .stat-label,
[data-bs-theme="dark"] .stat-grid-label {
  color: #6b7194;
}

[data-bs-theme="dark"] .stat-grid-item {
  border-color: #2d3147;
}

[data-bs-theme="dark"] .stat-grid-value {
  color: #d0d4e8;
}

[data-bs-theme="dark"] .player-card-popup {
  background: #1e2130;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .footer {
  border-color: #2d3147 !important;
  color: #6b7194;
}
