/*
 * LEGALOFE - STORICO GIOCATORE / POPUP
 * Restyling desktop coerente con Home / Risultati attuali.
 * Solo presentazione: nessuna modifica a markup o logica JS.
 */

.player-history-trigger {
  justify-self: start;
  margin: .18rem 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #1684f6;
  font: inherit;
  font-size: .59rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.player-history-trigger:hover,
.player-history-trigger:focus-visible {
  color: #102f4f;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.history-modal-open { overflow: hidden; }
.player-history-modal[hidden] { display: none !important; }

@media (min-width: 901px) {
  .player-history-modal {
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(28, 46, 61, .56);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }

  .player-history-panel {
    position: relative;
    width: min(1160px, calc(100vw - 56px));
    max-height: calc(100vh - 56px);
    overflow: hidden;
    border: 1px solid #d7e0e8;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(16, 47, 79, .22);
  }

  .player-history-panel h3 {
    min-height: 56px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0 64px 0 20px;
    border: 0;
    border-bottom: 1px solid #dce7f0;
    background: #eef3f6;
    color: #102f4f;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
  }

  .player-history-close {
    position: absolute;
    z-index: 2;
    top: 10px;
    right: 12px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid #cbd8e2;
    border-radius: 50%;
    background: #fff;
    color: #61768a;
    box-shadow: 0 2px 7px rgba(16, 47, 79, .08);
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
  }

  .player-history-close:hover,
  .player-history-close:focus-visible {
    border-color: #aebdca;
    background: #f4f7f9;
    color: #102f4f;
    outline: none;
  }

  .player-history-scroll {
    max-height: calc(100vh - 132px);
    overflow: auto;
    padding: 16px;
    background: #fff;
  }

  .player-history-table {
    width: 100%;
    min-width: 960px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #d7e0e8;
    border-radius: 12px;
    background: #fff;
    color: #102f4f;
    font-size: 12px;
  }

  .player-history-table th,
  .player-history-table td {
    height: 39px;
    padding: 7px 8px;
    border-right: 1px solid #dce7f0;
    border-bottom: 1px solid #dce7f0;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
  }

  .player-history-table th:nth-child(1),
  .player-history-table td:nth-child(1) { width: 16%; }
  .player-history-table th:nth-child(2),
  .player-history-table td:nth-child(2) { width: 14%; }
  .player-history-table th:nth-child(3),
  .player-history-table td:nth-child(3) { width: 15%; }
  .player-history-table th:nth-child(4),
  .player-history-table td:nth-child(4) { width: 6%; }
  .player-history-table th:nth-child(5),
  .player-history-table td:nth-child(5) { width: 5.5%; }
  .player-history-table th:nth-child(6),
  .player-history-table td:nth-child(6) { width: 6%; }
  .player-history-table th:nth-child(7),
  .player-history-table td:nth-child(7) { width: 6%; }
  .player-history-table th:nth-child(8),
  .player-history-table td:nth-child(8) { width: 6%; }
  .player-history-table th:nth-child(9),
  .player-history-table td:nth-child(9) { width: 6%; }
  .player-history-table th:nth-child(10),
  .player-history-table td:nth-child(10) { width: 10%; }
  .player-history-table th:nth-child(11),
  .player-history-table td:nth-child(11) { width: 10%; }

  .player-history-table th:nth-child(2),
  .player-history-table th:nth-child(3),
  .player-history-table td:nth-child(2),
  .player-history-table td:nth-child(3) {
    text-align: left;
  }

  .player-history-table th:last-child,
  .player-history-table td:last-child { border-right: 0; }
  .player-history-table tbody tr:last-child td { border-bottom: 0; }

  .player-history-table thead th {
    position: sticky;
    z-index: 1;
    top: 0;
    height: 38px;
    background: #eef3f6;
    color: #4f6780;
    font-size: 10px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: .015em;
    text-transform: uppercase;
  }

  .player-history-table tbody td {
    background: #fff;
    color: #183b59;
    font-size: 12px;
    font-weight: 500;
  }

  .player-history-table tbody tr:nth-child(even) td {
    background: #f7fafc;
  }

  .player-history-table tbody tr:hover td {
    background: #f1f6fa;
  }

  .player-history-table .history-current-season td {
    background: #edf5fa !important;
    color: #102f4f;
    font-weight: 650;
  }

  .player-history-table .history-current-season td:first-child::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 7px;
    border-radius: 50%;
    background: #28ad69;
    vertical-align: 1px;
  }
}

/* Il comportamento mobile esistente resta invariato. */
@media (max-width: 900px) {
  .player-history-trigger,
  .player-history-modal { display: none !important; }
}

/* ==========================================================
   v2 - OVERRIDE DEFINITIVO DESKTOP
   Elimina il blu notte residuo e forza testi leggibili.
   ========================================================== */
@media (min-width:901px){
  html body.page-rose .player-history-panel,
  html body.page-rose .player-history-scroll{
    background:#ffffff!important;
    color:#173a58!important;
  }

  html body.page-rose .player-history-panel h3{
    background:#eef3f6!important;
    color:#173a58!important;
    border-bottom:1px solid #d7e0e8!important;
  }

  html body.page-rose .player-history-table{
    background:#ffffff!important;
    color:#173a58!important;
    border-color:#d7e0e8!important;
  }

  html body.page-rose .player-history-table thead th{
    background:#eef3f6!important;
    color:#173a58!important;
    border-color:#d7e0e8!important;
    font-weight:800!important;
  }

  html body.page-rose .player-history-table tbody td{
    background:#ffffff!important;
    color:#2f4355!important;
    border-color:#d7e0e8!important;
    font-weight:500!important;
  }

  html body.page-rose .player-history-table tbody tr:nth-child(even) td{
    background:#f6f8fa!important;
    color:#2f4355!important;
  }

  html body.page-rose .player-history-table tbody tr:hover td{
    background:#f0f4f7!important;
    color:#173a58!important;
  }

  html body.page-rose .player-history-table tbody tr.history-current-season td,
  html body.page-rose .player-history-table .history-current-season td{
    background:#edf3f7!important;
    color:#173a58!important;
    font-weight:650!important;
  }

  html body.page-rose .player-history-table td a,
  html body.page-rose .player-history-table td strong,
  html body.page-rose .player-history-table td b,
  html body.page-rose .player-history-table td span{
    color:inherit!important;
  }

  html body.page-rose .player-history-close{
    background:#ffffff!important;
    color:#607488!important;
    border-color:#cbd8e2!important;
  }
}

/* ==========================================================
   v3 - DATI SU FONDO BIANCO UNIFORME
   Tutte le righe del corpo restano bianche, inclusa stagione attuale.
   ========================================================== */
@media (min-width:901px){
  html body.page-rose .player-history-table tbody tr td,
  html body.page-rose .player-history-table tbody tr:nth-child(even) td,
  html body.page-rose .player-history-table tbody tr:hover td,
  html body.page-rose .player-history-table tbody tr.history-current-season td,
  html body.page-rose .player-history-table .history-current-season td{
    background:#ffffff!important;
    color:#2f4355!important;
  }

  html body.page-rose .player-history-table tbody tr.history-current-season td,
  html body.page-rose .player-history-table .history-current-season td{
    font-weight:650!important;
  }
}
