/**
 * Scoresheet Page Styles - COMPACT VERSION
 * Both teams visible on same screen
 */

/* ========================================
   SCORESHEET HEADER - COMPACT
   ======================================== */

.scoresheet-header {
  text-align: center;
  margin-bottom: 12px;
}

.scoresheet-header .page-title {
  font-size: 1.2em;
  margin-bottom: 5px;
}

.match-meta {
  font-size: 0.95em;
  color: var(--text-secondary);
  margin-bottom: 0;
}

.match-score {
  background-color: var(--accent-color);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
}

[data-theme="dark"] .match-score {
  background-color: var(--accent-color);
}

/* ========================================
   TEAM SECTIONS - COMPACT
   ======================================== */

.team-section {
  margin-bottom: 18px;
}

.team-section .section-title {
  font-size: 1.05em;
  margin-bottom: 8px;
  padding-bottom: 4px;
}

/* ========================================
   SCORESHEET TABLE - COMPACT
   ======================================== */

.scoresheet-table th {
  padding: 4px 3px;
  white-space: nowrap;
}

.scoresheet-table td {
  padding: 2px 3px;
  vertical-align: middle;
  transition: none !important;
}

.scoresheet-table * {
  transition: none !important;
}

/* Player ID styling */
.player-id {
  font-size: 0.7em;
  color: var(--text-muted);
  margin-right: 5px;
}

/* Player cell */
.player-cell {
  cursor: pointer;
  padding: 4px 6px !important;
  transition: none !important;
}

/* Score cells - FIXED HEIGHT to prevent overlap */
.score-cell {
  cursor: pointer;
  position: relative;
  height: 38px;
  padding: 0 !important;
  transition: none !important;
}

.score-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding-top: 8px;
}

.score-value {
  font-size: 1em;
  font-weight: 500;
  position: relative;
  z-index: 2;
}

/* Totals column */
.totals-col {
  font-weight: 600;
  background-color: var(--bg-secondary);
  border-left: 2px solid var(--border-color);
}

/* Summary rows - COMPACT */
.subtotal-row {
  background-color: var(--table-row-even) !important;
  font-weight: 500;
}

.subtotal-row td {
  padding: 3px 4px !important;
}

.adjustment-row {
  background-color: var(--table-row-odd) !important;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.8em;
}

.adjustment-row td {
  padding: 3px 4px !important;
}

.grandtotal-row {
  background-color: var(--bg-secondary) !important;
  font-weight: 700;
  font-size: 0.95em;
  border-top: 2px solid var(--border-color);
}

.grandtotal-row td {
  padding: 5px 4px !important;
}

/* ========================================
   BADGES - POSITIONED ABOVE SCORE
   ======================================== */

.badge {
  position: absolute;
  font-size: 0.5em;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  z-index: 3;
  line-height: 1.2;
}

/* All top badges positioned ABOVE the score */
.badge-forfeit,
.badge-breakrun,
.badge-ero {
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
}

/* Forfeit badge - red */
.badge-forfeit {
  background-color: #ef4444;
  color: #ffffff;
}

[data-theme="dark"] .badge-forfeit {
  background-color: #dc2626;
}

/* Break Run badge - orange */
.badge-breakrun {
  background-color: #f59e0b;
  color: #ffffff;
}

[data-theme="dark"] .badge-breakrun {
  background-color: #d97706;
}

/* Run Out badge - blue */
.badge-ero {
  background-color: #3b82f6;
  color: #ffffff;
}

[data-theme="dark"] .badge-ero {
  background-color: #2563eb;
}

/* Break badge - bottom left corner (small) */
.badge-break {
  bottom: 2px;
  left: 2px;
  background-color: #8b5cf6;
  color: #ffffff;
  font-size: 0.6em;
  padding: 1px 3px;
}

[data-theme="dark"] .badge-break {
  background-color: #7c3aed;
}

/* ========================================
   WINNER HIGHLIGHTING (Grand Total Only)
   ======================================== */

td.winner {
  background-color: #86efac !important;
  color: #065f46;
  font-weight: 600;
}

[data-theme="dark"] td.winner {
  background-color: #166534 !important;
  color: #bbf7d0;
}

/* ========================================
   HOVER EFFECTS
   ======================================== */

.is-hl {
  background-color: #520341 !important;
  transition: none !important;
}

[data-theme="dark"] .is-hl {
  background-color: #4e1d1b !important;
}

.winner-score-hover {
  background-color: #86efac !important;
  color: #065f46;
  font-weight: 600;
  transition: none !important;
}

[data-theme="dark"] .winner-score-hover {
  background-color: #166534 !important;
  color: #bbf7d0;
}

.loser-score-hover {
  background-color: #fca5a5 !important;
  color: #7f1d1d;
  transition: none !important;
}

[data-theme="dark"] .loser-score-hover {
  background-color: #7f1d1d !important;
  color: #fca5a5;
}

/* ========================================
   MATCH SUMMARY - COMPACT
   ======================================== */

.match-summary-section {
  margin-top: 20px;
}

.match-summary-section .section-title {
  font-size: 1.05em;
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.match-summary-section .table-wrapper {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.summary-table {
  max-width: 500px;
  width: auto;
  margin: 0 auto;
}

.summary-table td,
.summary-table th {
  padding: 6px 12px;
  white-space: nowrap;
}

.summary-table td:first-child,
.summary-table th:first-child {
  min-width: 180px;
}

/* ========================================
   MOBILE
   ======================================== */

@media (max-width: 768px) {
  .scoresheet-header .page-title {
    font-size: 1.1em;
  }

  .match-meta {
    font-size: 0.9em;
  }

  .score-cell {
    height: 36px;
  }

  .score-container {
    padding-top: 7px;
  }

  .badge {
    font-size: 0.5em;
  }

  .summary-table {
    max-width: 100%;
  }
}

/* ========================================
   PRINT
   ======================================== */

@media print {
  .is-hl,
  .winner-score-hover,
  .loser-score-hover {
    background-color: transparent !important;
  }

  .badge {
    border: 1px solid #333;
  }

  .team-section {
    page-break-inside: avoid;
  }
}
