/* SEMPRE PENYA — Calendari + Estadístiques Temporada. */

body.feature-modal-open { overflow: hidden; }

.feature-header-button {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
}
.feature-header-button:hover { background: rgba(255,255,255,.18); }

.feature-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 22, 18, .68);
  backdrop-filter: blur(2px);
}
.feature-modal-backdrop[hidden] { display: none; }

.feature-modal {
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.30);
  padding: 20px;
}
.stats-modal-card { width: min(860px, 100%); }

.feature-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.feature-modal-heading h2 {
  margin: 0;
  color: #111827;
  font-size: 1.45rem;
}
.feature-kicker {
  margin: 0 0 5px;
  color: #005441;
  font-size: .69rem;
  font-weight: 900;
  letter-spacing: .09em;
}
.feature-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #374151;
  font-size: 1.5rem;
  cursor: pointer;
}

.calendar-list { display: grid; gap: 8px; }
.calendar-section-label {
  margin-top: 8px;
  padding: 2px 2px 0;
  color: #005441;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.calendar-game {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 13px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  text-decoration: none;
}
.calendar-game[href]:hover {
  border-color: #9fc9bd;
  box-shadow: 0 5px 18px rgba(0,84,65,.08);
}
.calendar-game.next {
  border: 2px solid #0B6F59;
  background: #eaf6f2;
  box-shadow: 0 6px 20px rgba(0,84,65,.10);
}
.calendar-game-main { min-width: 0; }
.calendar-game-date { color: #6b7280; font-size: .75rem; }
.calendar-game-matchup {
  margin-top: 3px;
  font-size: .97rem;
  line-height: 1.28;
  font-weight: 850;
}
.calendar-game-competition {
  margin-top: 4px;
  color: #0B6F59;
  font-size: .73rem;
  font-weight: 800;
}
.calendar-game-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}
.calendar-score { font-size: 1.2rem; }
.calendar-stats { color: #0B6F59; font-size: .68rem; font-weight: 800; }
.calendar-pending { color: #6b7280; font-size: .72rem; font-weight: 800; }
.calendar-game.next .calendar-pending {
  padding: 4px 7px;
  border-radius: 999px;
  background: #005441;
  color: #fff;
  font-size: .65rem;
  letter-spacing: .05em;
}
.calendar-loading { margin: 12px 2px; color: #6b7280; }

.stats-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
}
.stats-control-label {
  margin: 0 0 6px;
  color: #374151;
  font-size: .76rem;
  font-weight: 900;
}
.stats-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.stats-chip-row button {
  min-height: 34px;
  border: 1px solid #0B6F59;
  border-radius: 9px;
  padding: 0 12px;
  background: #fff;
  color: #0B6F59;
  font-weight: 850;
  cursor: pointer;
}
.stats-chip-row button.selected {
  background: #005441;
  color: #fff;
}
.stats-last-games {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}
.stats-last-games button {
  flex: 0 0 38px;
  padding: 0;
}
.stats-summary {
  margin: 7px 0 10px;
  color: #6b7280;
  font-size: .76rem;
  font-weight: 750;
}
.stats-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
.stats-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  background: #fff;
}
.stats-table th,
.stats-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef0f2;
  text-align: center;
  font-size: .78rem;
  white-space: nowrap;
}
.stats-table thead th {
  background: #effaf5;
  color: #005441;
  font-size: .72rem;
  font-weight: 900;
}
.stats-table tbody th {
  text-align: left;
  color: #111827;
  font-weight: 850;
}
.stats-table tbody tr:last-child th,
.stats-table tbody tr:last-child td { border-bottom: 0; }

.feature-inline-message {
  margin: 10px 0;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: .8rem;
  line-height: 1.4;
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.feature-inline-message[data-kind="error"] {
  background: #fff1f2;
  color: #991b1b;
  border-color: #fecdd3;
}
.feature-inline-message[data-kind="warning"],
.feature-inline-message[data-kind="working"] {
  background: #fff7e6;
  color: #76530c;
  border-color: #f6dfaa;
}

@media (max-width: 760px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .feature-header-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: .75rem;
  }
  .feature-modal-backdrop { padding: 10px; align-items: flex-start; }
  .feature-modal {
    max-height: calc(100vh - 20px);
    margin-top: 0;
    padding: 16px;
    border-radius: 14px;
  }
  .calendar-game { gap: 10px; padding: 10px; }
  .calendar-game-matchup { font-size: .9rem; }
  .calendar-score { font-size: 1.05rem; }
  .stats-table th,
  .stats-table td { padding: 8px; }
}

@media (max-width: 620px) {
  .header-inner {
    flex-wrap: wrap;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  .brand-row { flex: 1 1 auto; }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}


/* v59 — paritat amb l'app + ordenació per columna */
.stats-scope-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.stats-expand-toggle {
  flex: 1 1 180px;
  min-height: 34px;
  border: 1px solid #0B6F59;
  border-radius: 9px;
  padding: 0 10px;
  background: #fff;
  color: #0B6F59;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}
.stats-expand-toggle.selected {
  background: #005441;
  color: #fff;
}
.stats-scope-row .stats-last-games {
  flex: 1 1 auto;
  min-width: 0;
}
.stats-sort-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.stats-sort-button:focus-visible,
.stats-expand-toggle:focus-visible,
.stats-chip-row button:focus-visible {
  outline: 2px solid #0B6F59;
  outline-offset: 2px;
}
.stats-table th[aria-sort="ascending"],
.stats-table th[aria-sort="descending"] {
  background: #dcefe8;
}
.stats-valuation { font-weight: 850; }

@media (max-width: 620px) {
  .stats-scope-row {
    align-items: stretch;
  }
  .stats-expand-toggle {
    flex-basis: 150px;
    padding: 0 7px;
    font-size: .72rem;
  }
}
