/**
 * Players & Teams Page Styles
 * Western Badminton Inc - Tournament Manager
 */

:root {
  --tm-primary: #D84A15;
  --tm-primary-dark: #B83E11;
  --tm-dark: #111;
  --tm-bg: #f4f5f7;
  --tm-card: #ffffff;
  --tm-border: rgba(0,0,0,0.06);
}

body {
  background: var(--tm-bg);
  font-family: 'Rubik', sans-serif;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
}

/* ==================== SHELL ==================== */
.players-shell {
  max-width: 100%;
  margin: 0;
  padding: 2rem;
}

/* ==================== HEADER ==================== */
.tm-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tm-breadcrumb {
  font-size: 0.78rem;
  color: #8b8b8b;
  margin-bottom: 0.25rem;
}

.tm-breadcrumb a {
  color: var(--tm-primary);
  text-decoration: none;
  font-weight: 600;
}

.tm-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--tm-dark);
  margin: 0;
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--tm-border);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  margin-bottom: 0.75rem;
}

.stat-value {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  color: var(--tm-dark);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.78rem;
  color: #888;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==================== FILTER BAR ==================== */
.filter-bar {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid var(--tm-border);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: end;
}

/* ==================== PLAYER CARDS (GRID VIEW) ==================== */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.player-card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.player-card:hover {
  border-color: rgba(216,74,21,0.2);
  box-shadow: 0 6px 20px rgba(216,74,21,0.1);
  transform: translateY(-2px);
}

.player-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--tm-primary), #FB5B21);
}

.player-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 1rem;
  font-family: 'Oswald', sans-serif;
}

.player-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--tm-dark);
  margin-bottom: 0.5rem;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.player-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #6c757d;
}

.player-info-item i {
  width: 16px;
  text-align: center;
}

.player-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.player-tag {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-singles { background: rgba(79,172,254,0.12); color: #4facfe; }
.tag-doubles { background: rgba(67,233,123,0.12); color: #43e97b; }
.tag-mixed { background: rgba(240,147,251,0.12); color: #f093fb; }
.tag-member { background: rgba(216,74,21,0.12); color: var(--tm-primary); }

.player-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ==================== PLAYER LIST (LIST VIEW) ==================== */
.players-list {
  display: none;
}

.players-list.active {
  display: block;
}

.players-grid.active {
  display: grid;
}

.player-list-item {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: all 0.3s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-list-item:hover {
  border-color: rgba(216,74,21,0.2);
  box-shadow: 0 4px 16px rgba(216,74,21,0.08);
}

.player-list-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  font-family: 'Oswald', sans-serif;
  flex-shrink: 0;
}

.player-list-info {
  flex: 1;
  min-width: 0;
}

.player-list-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--tm-dark);
  margin-bottom: 0.25rem;
}

.player-list-details {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #6c757d;
}

.player-list-detail {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.player-list-detail i {
  font-size: 0.9rem;
  width: 14px;
}

.player-list-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.player-list-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ==================== BUTTONS ==================== */
.tm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tm-btn-primary {
  background: linear-gradient(135deg, #D84A15, #FB5B21);
  color: white;
  box-shadow: 0 2px 10px rgba(216,74,21,0.25);
}

.tm-btn-primary:hover {
  box-shadow: 0 4px 20px rgba(216,74,21,0.35);
  transform: translateY(-1px);
}

.tm-btn-outline {
  background: transparent;
  color: #555;
  border: 2px solid #dee2e6;
}

.tm-btn-outline:hover {
  border-color: var(--tm-primary);
  color: var(--tm-primary);
}

.tm-btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

.tm-btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border: none;
  color: #666;
  cursor: pointer;
}

.tm-btn-icon:hover {
  background: rgba(216,74,21,0.1);
  color: var(--tm-primary);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.empty-state i {
  font-size: 4rem;
  color: #dee2e6;
  margin-bottom: 1.5rem;
}

.empty-state h4 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* ==================== VIEW TOGGLE ==================== */
.view-toggle {
  display: inline-flex;
  background: white;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.view-toggle button {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6c757d;
}

.view-toggle button.active {
  background: linear-gradient(135deg, var(--tm-primary), #FB5B21);
  color: white;
  box-shadow: 0 2px 8px rgba(216,74,21,0.3);
}

/* ==================== PARTICIPATION HISTORY ==================== */
.history-item {
  padding: 0.875rem;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--tm-primary);
  transition: all 0.2s ease;
}

.history-item:hover {
  background: #f1f3f5;
  transform: translateX(4px);
}

.history-section {
  margin-bottom: 2rem;
}

.history-section:last-child {
  margin-bottom: 0;
}

.history-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e9ecef;
}

.history-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #212529;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-title i {
  color: var(--tm-primary);
  font-size: 1.25rem;
}

.history-count {
  background: rgba(216,74,21,0.1);
  color: var(--tm-primary);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.participation-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.participation-stat-card {
  background: linear-gradient(135deg, rgba(79,172,254,0.08), rgba(0,242,254,0.08));
  border-radius: 12px;
  padding: 1rem;
  border-left: 4px solid #4facfe;
}

.participation-stat-value {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  color: #212529;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.participation-stat-label {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 1.5rem;
  border-left: 2px solid #dee2e6;
}

.timeline-item:last-child {
  border-left: 2px solid transparent;
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tm-primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--tm-primary);
}

.timeline-content {
  background: white;
  padding: 0.875rem;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
}

.timeline-content:hover {
  border-color: var(--tm-primary);
  box-shadow: 0 2px 8px rgba(216,74,21,0.1);
}

/* ==================== ACCORDION STYLES ==================== */
.accordion-button {
  font-size: 0.95rem;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.accordion-button:not(.collapsed) {
  background-color: #fff;
  color: var(--tm-primary);
  box-shadow: none;
}

.accordion-button:focus {
  border-color: rgba(216,74,21,0.25);
  box-shadow: 0 0 0 0.25rem rgba(216,74,21,0.1);
}

.accordion-button::after {
  margin-left: auto;
}

.accordion-body {
  padding: 1.25rem;
  max-height: 400px;
  overflow-y: auto;
}

.accordion-item {
  border: none;
  margin-bottom: 0.75rem;
}

.accordion-item:first-of-type .accordion-button {
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.accordion-item:last-of-type .accordion-button.collapsed {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .players-shell {
    padding: 1rem;
  }

  .tm-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .players-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .player-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .player-list-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .player-list-details {
    flex-direction: column;
    gap: 0.5rem;
  }
}
