/**
 * Calendar Page Styles
 * Styles the calendar in a card-based grid layout similar to league leader cards
 */

/* ========================================
   PAGE HEADER
   ======================================== */

.calendar-instructions {
  margin-bottom: 20px;
}

.calendar-instructions p {
  margin: 5px 0;
  color: var(--text-secondary);
}

.match-winner {
  color: #28a745;
  font-weight: bold;
}

[data-theme="dark"] .match-winner {
  color: #5fd17a;
}

/* ========================================
   CALENDAR GRID LAYOUT
   ======================================== */

.calendar-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin-bottom: 30px;
}

@media (max-width: 992px) {
  .calendar-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .calendar-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* ========================================
   CALENDAR CARDS (styled like leader cards)
   ======================================== */

.calendar-card {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px var(--shadow-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.calendar-card-header {
  background-color: var(--table-header-bg, var(--bg-secondary));
  color: var(--table-header-text, var(--text-primary));
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  font-weight: 600;
  font-size: 1.05em;
}

.calendar-card-body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-elevated);
}

/* ========================================
   MATCH ROWS
   ======================================== */

.matches-container {
  flex: 1;
}

/* Fill gap above MVP section with matching background color */
.calendar-card-body:has(.mvp-row) .matches-container {
  background-color: var(--bg-secondary);
}

.match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 15px;
  border-bottom: 1px solid var(--border-color);
  min-height: 50px;
}

/* Only remove bottom border if it's truly the last element in card body */
.calendar-card-body > .match-row:last-child {
  border-bottom: none;
}

.match-row:not(.match-complete):hover {
  background-color: var(--table-hover);
}

/* Dim BYE matches since they're not real games */
.match-row.bye-match {
  opacity: 0.3;
}

.match-row.bye-match:hover {
  opacity: 0.8;
}

/* Match content (teams and VS) */
.match-content {
  flex: 1;
  text-align: center;
}

.team-line {
  display: block;
  line-height: 1.2;
  color: var(--text-primary);
  font-size: 0.95em;
}

.team-line.home-team {
  font-weight: bold;
}

.team-line.winner {
  color: #28a745;
  font-weight: bold;
}

[data-theme="dark"] .team-line.winner {
  color: #5fd17a;
}

.vs-line {
  display: block;
  font-size: 0.75em;
  color: var(--text-muted);
  margin: 1px 0;
  letter-spacing: 0.1em;
}

.winner-circle {
  color: #28a745;
  font-size: 0.7em;
  margin-right: 4px;
}

[data-theme="dark"] .winner-circle {
  color: #5fd17a;
}

/* ========================================
   COMPLETED MATCH LINKS
   ======================================== */

.match-complete .match-link {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 100%;
  transition: background-color 0.2s ease;
}

.match-complete .match-link:hover {
  background-color: var(--table-hover);
}

.match-complete .match-link:hover .team-line {
  color: var(--accent-color);
}

.match-complete .match-link:hover .team-line.winner {
  color: #28a745;
}

[data-theme="dark"] .match-complete .match-link:hover .team-line.winner {
  color: #5fd17a;
}

/* ========================================
   PRINTER ICON
   ======================================== */

.match-actions {
  flex: 0 0 auto;
  margin-left: 10px;
}

.printer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 1.3em;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.printer-link:hover {
  background-color: var(--bg-secondary);
  transform: scale(1.1);
}

.printer-link:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* ========================================
   PLAYOFFS LABEL
   ======================================== */

.playoffs-label {
  font-weight: 600;
  font-size: 1.3em;
  text-align: center;
  padding: 10px 0;
  color: var(--text-primary);
}

/* ========================================
   MVP ROW
   ======================================== */

.mvp-row {
  padding: 6px 12px;
  text-align: center;
  background-color: var(--bg-secondary);
  font-size: 0.95em;
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: auto; /* Push to bottom of flex container */
  display: flex;
  align-items: center; /* Vertically center */
  justify-content: center; /* Horizontally center */
}

.mvp-row strong {
  display: inline;
  font-size: 1em;
  margin-right: 4px;
}

.mvp-row a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.mvp-row a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ========================================
   ALERT MESSAGE
   ======================================== */

.alert-info {
  background-color: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

[data-theme="dark"] .alert-info {
  background-color: #1a2332;
  border-color: #2c4a6e;
  color: #90caf9;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  .no-print,
  .match-actions,
  .printer-link {
    display: none !important;
  }

  .calendar-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .calendar-card {
    page-break-inside: avoid;
    box-shadow: none;
  }

  .match-row {
    min-height: auto;
    padding: 8px 12px;
  }
}
