/* ============================================
   MASTERS LEADERBOARD — Augusta Physical Scoreboard
   Faithful recreation of the iconic green board at Augusta National
   ============================================ */

/* ---- Board Outer Frame ---- */
.scoreboard-container {
  max-width: 860px;
  margin: 0 auto var(--space-xl);
  position: relative;
  padding-top: 28px; /* room for arch overhang */
}

/* Board frame/legs shadow */
.scoreboard-container::before {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 16px;
  background: rgba(0,0,0,0.25);
  border-radius: 50%;
  filter: blur(8px);
  z-index: 0;
}

/* ---- Main Board ---- */
.scoreboard {
  background: #1b3425;
  border-radius: 4px 4px 4px 4px;
  overflow: visible;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.55),
    0 4px 10px rgba(0,0,0,0.35),
    inset 0 0 0 3px #12251a,
    inset 0 0 0 5px #2a4a35;
  position: relative;
  z-index: 1;
}

/* ---- Arched Top "LEADERS" Header ---- */
.scoreboard-arch {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: 60px;
  background: #1b3425;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  box-shadow:
    0 -4px 12px rgba(0,0,0,0.3),
    inset 0 0 0 3px #12251a,
    inset 0 0 0 5px #2a4a35;
  z-index: 2;
}

.scoreboard-arch-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ---- Header bar below arch ---- */
.scoreboard-header {
  background: #162d1e;
  padding: 10px var(--space-md) 8px;
  text-align: center;
  border-bottom: 2px solid #0e1f14;
  margin-top: 8px;
}

.scoreboard-subtitle {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.7rem;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* ---- Column Headers ---- */
.scoreboard-columns {
  display: grid;
  grid-template-columns: 48px 1fr 170px 48px;
  padding: 5px 0;
  background: #142b1c;
  border-bottom: 2px solid #0e1f14;
}

.scoreboard-columns .col-header {
  padding: 0 12px;
}

.scoreboard-columns .col-header:nth-child(2) {
  border-left: 4px solid #1b3425;
  border-right: 4px solid #1b3425;
}

.scoreboard-columns .col-header.earnings-header {
  border-right: 4px solid #1b3425;
  text-align: right;
}

.col-header {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 600;
}

.col-header.earnings-header { text-align: right; }
.col-header.movement-header { text-align: center; }

/* ---- Scoreboard Rows — WHITE NAME CARDS ---- */
.scoreboard-row {
  display: grid;
  grid-template-columns: 48px 1fr 170px 48px;
  align-items: stretch;
  min-height: 44px;
  cursor: pointer;
  border-bottom: 3px solid #1b3425;
  position: relative;
  background: transparent;
}

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

/* ---- Rank number — stays on green ---- */
.rank-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 0 6px;
}

.rank-plate {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  min-width: 28px;
  text-align: center;
}

.rank-plate.top-three {
  color: #f5e066;
}

/* ---- White name card ---- */
.entry-cell {
  background: #ffffff;
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 4px solid #1b3425;
  border-right: 4px solid #1b3425;
  overflow: hidden;
}

.entry-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.86rem;
  font-weight: 700;
  color: #111111;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.entry-owner {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  color: #888888;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

/* Hover: subtle cream tint */
.scoreboard-row:hover .entry-cell {
  background: #f8f5ec;
}

/* ---- Earnings — flip tile container ---- */
.earnings-cell {
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  border-right: 4px solid #1b3425;
  overflow: hidden;
}

.scoreboard-row:hover .earnings-cell {
  background: #f8f5ec;
}

/* The flip tile wrapper */
.flip-tile {
  display: inline-block;
  position: relative;
  perspective: 400px;
}

.flip-tile-face {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: #c41e1e;
  display: block;
  backface-visibility: hidden;
}

.flip-tile-face.zero {
  color: #aaaaaa;
}

/* The "falling off" keyframe — old number drops down */
@keyframes tileDropOut {
  0%   { transform: rotateX(0deg);    opacity: 1; }
  40%  { transform: rotateX(80deg);   opacity: 0.6; }
  100% { transform: rotateX(90deg);   opacity: 0; }
}

/* New number flips in from top */
@keyframes tileFlipIn {
  0%   { transform: rotateX(-90deg);  opacity: 0; }
  60%  { transform: rotateX(-10deg);  opacity: 0.8; }
  100% { transform: rotateX(0deg);    opacity: 1; }
}

.flip-tile-face.dropping {
  animation: tileDropOut 0.22s ease-in forwards;
  transform-origin: center bottom;
}

.flip-tile-face.flipping-in {
  animation: tileFlipIn 0.28s ease-out forwards;
  transform-origin: center top;
}

/* ---- Movement ---- */
.movement-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.movement {
  display: flex;
  align-items: center;
  gap: 1px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
}

.movement.up   { color: #4ade80; }
.movement.down { color: #f87171; }
.movement.same { color: rgba(255,255,255,0.25); }

/* ---- Expanded Detail Row ---- */
.row-detail {
  display: none;
  grid-column: 1 / -1;
  background: #f0ede5;
  border-top: 1px solid #d8d3c8;
  padding: 12px 14px;
}

.row-detail.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}

.player-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: #ffffff;
  border-radius: 3px;
  border-left: 3px solid #1b3425;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.player-chip-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.76rem;
  color: #111111;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.player-chip-group {
  font-size: 0.58rem;
  color: #999999;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-top: 1px;
}

.player-chip-earnings {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c41e1e;
  white-space: nowrap;
}

.player-chip-earnings.zero {
  color: #bbbbbb;
}

/* ---- Board Bottom Bar ---- */
.scoreboard-footer {
  background: #142b1c;
  border-top: 2px solid #0e1f14;
  padding: 7px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scoreboard-footer-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e03030;
  margin-right: 5px;
  animation: pulse 2s infinite;
  vertical-align: middle;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ---- View All Button ---- */
.view-all-btn {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 24px;
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  transition: all 0.2s ease;
}

.view-all-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #ffffff;
  border-color: rgba(255,255,255,0.4);
}

/* ---- Full Standings Table ---- */
.standings-table-wrapper {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.06);
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
}

.standings-table thead {
  background: #1b3425;
}

.standings-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #0e1f14;
}

.standings-table th.text-right  { text-align: right; }
.standings-table th.text-center { text-align: center; }

.standings-table td {
  padding: 9px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  vertical-align: middle;
}

.standings-table tbody tr {
  transition: background 0.12s;
  cursor: pointer;
}

.standings-table tbody tr:hover {
  background: rgba(27,52,37,0.05);
}

.standings-table .rank-num {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: #1b3425;
  font-size: 1rem;
}

.standings-table .entry-name-cell {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.standings-table .owner-name {
  display: block;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.standings-table .earnings {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: #c41e1e;
  text-align: right;
  font-size: 0.9rem;
}

.standings-table .movement-indicator {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}

.standings-table .movement-indicator.up   { color: #22c55e; }
.standings-table .movement-indicator.down { color: #ef4444; }
.standings-table .movement-indicator.same { color: var(--text-light); }

/* Expandable rows in standings */
.standings-detail-row { display: none; }
.standings-detail-row.open { display: table-row; }

.standings-detail-row td {
  padding: 10px 14px;
  background: #f6faf7;
  border-bottom: 2px solid rgba(0,0,0,0.06);
}

.detail-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
}

.detail-player-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--white);
  border-radius: 4px;
  border-left: 3px solid #1b3425;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.detail-player-info { display: flex; flex-direction: column; }

.detail-player-name {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-player-group {
  font-size: 0.65rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-player-earnings {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #c41e1e;
}

/* ---- Search & Filter ---- */
.standings-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 2.4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  border: 2px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  background: var(--white);
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.search-box input:focus {
  outline: none;
  border-color: #1b3425;
}

.search-box::before {
  content: '⛳';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  opacity: 0.4;
}

.results-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-xl);
}

.pagination button {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border: 2px solid #1b3425;
  background: var(--white);
  color: #1b3425;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination button:hover,
.pagination button.active {
  background: #1b3425;
  color: var(--white);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .scoreboard-columns,
  .scoreboard-row {
    grid-template-columns: 40px 1fr 120px 44px;
  }

  .entry-name      { font-size: 0.78rem; }
  .earnings-amount { font-size: 0.82rem; }
  .player-grid     { grid-template-columns: 1fr; }

  .standings-table th,
  .standings-table td { padding: 8px 10px; font-size: 0.8rem; }

  .standings-controls { flex-direction: column; align-items: stretch; }
  .search-box         { max-width: 100%; }
  .detail-players-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .scoreboard-columns,
  .scoreboard-row {
    grid-template-columns: 34px 1fr 96px 36px;
    padding: 0 8px;
  }

  .entry-name   { font-size: 0.72rem; }
  .entry-owner  { display: none; }
  .earnings-amount { font-size: 0.72rem; }
  .scoreboard-arch { width: 88%; }
  .scoreboard-arch-text { font-size: 1rem; letter-spacing: 0.18em; }
}
