/* =========================================
1. FONTS & VARIABILI
========================================= */
@font-face {
  font-family: 'DrukWide';
  src: url('/assets/doc/DrukWideBold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'HelveticaBold';
  src: url('/assets/doc/HelveticaBold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
}

:root {
  --rosa-neon: #ff19ff;
  --viola: #5e11f7;
  --bianco: #ffffff;
  --nero-transp: rgba(0, 0, 0, 0.85);
  --verde: #00ff66;
  --rosso: #ff3333;
}

/* =========================================
BASE
========================================= */
body {
  color: var(--bianco);
  font-family: 'HelveticaBold', sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100vh;
  background: url('/assets/imm/sfondouml25.jpg') center/cover no-repeat;
  z-index: -1;
  will-change: transform;
}

/* Classi Font Utility */
.druk-font { 
  font-family: 'DrukWide', sans-serif; 
  letter-spacing: 0; 
  text-transform: uppercase;
}
.helvetica-font { 
  font-family: 'HelveticaBold', sans-serif; 
  letter-spacing: 0; 
  text-transform: uppercase;
}

/* Container principale */
.container {
  max-width: 1100px;
  width: 95%;
  margin: 20px auto;
  padding: 0;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(20px); } 
  to { opacity: 1; transform: translateY(0); } 
}

/* =========================================
2. HEADER GIOCATORE
========================================= */
.player-header-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  background: var(--nero-transp);
  padding: 30px;
  border-radius: 16px;
  margin-bottom: 30px;
  border: 1px solid rgba(255, 25, 255, 0.15);
}

.ph-identity {
  display: flex;
  align-items: center;
  gap: 30px;
  flex: 1;
  min-width: 0;
}

.ph-image-wrapper img {
  width: 200px; 
  height: 200px; 
  object-fit: cover; 
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.ph-image-wrapper img:hover { 
  transform: scale(1.02); 
}

.ph-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}

/* Ruolo + bandiera */
.ph-flag-role {
  display: flex; 
  align-items: center; 
  gap: 8px; 
  margin-bottom: 12px;
  font-size: 0.9rem; 
  text-transform: uppercase; 
  letter-spacing: 0; 
  color: #ffffff;
}
.ph-flag-role .flag { 
  width: 24px; 
  border-radius: 4px; 
}

/* NOMI */
.ph-names { 
  display: flex; 
  flex-direction: column; 
  align-items: flex-start; 
  line-height: 1; 
  width: 100%; 
}

.ph-nome {
  font-family: 'DrukWide', sans-serif; 
  font-size: 1.1rem;
  color: var(--bianco);
  margin-bottom: 4px; 
  text-transform: uppercase; 
  letter-spacing: 0;
}

.ph-cognome {
  font-family: 'DrukWide', sans-serif; 
  font-size: 3rem;
  color: var(--rosa-neon);
  text-transform: uppercase; 
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Riduzione cognome se > 11 caratteri */
.ph-cognome[data-long="true"] {
  font-size: 2rem;
}

/* =========================================
STATS HEADER (GOL, MEDIA, PRESENZE, V/N/P)
========================================= */
.ph-stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 100%;
  flex-shrink: 0;
}

.stats-col { 
  display: flex; 
  flex-direction: column; 
  justify-content: center; 
  gap: 16px; 
  padding: 0 20px; 
}

.stats-col.border-left { 
  border-left: 1px solid rgba(255,255,255,0.2); 
}

.stat-box { 
  text-align: left; 
}

.stat-label {
  font-family: 'HelveticaBold', sans-serif; 
  font-size: 0.7rem; 
  color: var(--rosa-neon);
  letter-spacing: 0; 
  margin-bottom: 4px; 
  text-transform: uppercase;
}

.stat-number { 
  font-family: 'DrukWide', sans-serif;
  font-size: 2rem; 
  color: var(--bianco); 
  line-height: 1;
}

.stat-outcome { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

/* Pallini V/N/P */
.dot { 
  width: 8px; 
  height: 8px; 
  border-radius: 50%; 
}
.dot-v { background: var(--verde); }
.dot-n { background: var(--bianco); }
.dot-p { background: var(--rosso); }

/* =========================================
3. PALMARES
========================================= */
.trophies-container {
  position: relative;
  background: rgba(0,0,0,0.7);
  padding: 35px 30px 25px 30px;
  border-radius: 16px;
  margin-bottom: 30px;
  border: 1px solid rgba(255,25,255,0.25);
}

.section-label {
  position: absolute;
  top: 15px;
  left: 20px;
  font-family: 'HelveticaBold', sans-serif;
  font-size: 0.8rem;
  color: var(--bianco);
  text-transform: uppercase;
  letter-spacing: 0;
}

.trophies-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  margin-top: 10px;
}

.trophy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 110px;
  width: 90px;
  transition: transform 0.3s ease;
}

.trophy-card:hover {
  transform: translateY(-3px);
}

.trophy-upper-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.trophy-img-std {
  height: 55px;
  width: auto;
  margin-bottom: 5px;
}

.trophy-icon-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.trophy-multiplier {
  font-size: 1.3rem;
  color: var(--rosa-neon);
}

.trophy-img-small {
  height: 35px;
  width: auto;
}

.trophy-year {
  font-size: 0.85rem;
  color: var(--bianco);
  margin-top: 2px;
}

.trophy-label {
  font-family: 'HelveticaBold', sans-serif;
  font-size: 0.6rem;
  color: #ffffff;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-top: 8px;
  width: 100%;
  line-height: 1.2;
}

/* =========================================
4. STAGIONI
========================================= */
.season-box {
  margin-bottom: 16px; 
  border: 1px solid rgba(255,255,255,0.1); 
  border-radius: 12px;
  background: rgba(0,0,0,0.7); 
  overflow: hidden; 
  transition: border-color 0.3s;
}

.season-box:hover { 
  border-color: rgba(255, 25, 255, 0.4); 
}

.season-header {
  padding: 16px 20px; 
  cursor: pointer; 
  display: flex; 
  justify-content: space-between;
  align-items: center; 
  background: rgba(255, 255, 255, 0.05);
  font-family: 'HelveticaBold', sans-serif;
  font-size: 0.8rem;
  color: var(--bianco);
  text-transform: uppercase;
}

.season-header:hover { 
  background: rgba(255, 255, 255, 0.1); 
}

.season-info-main { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}

.season-team-logo { 
  width: 32px; 
  height: 32px; 
  object-fit: contain; 
}

.season-text-group { 
  display: flex; 
  flex-direction: column; 
  align-items: flex-start; 
}

.season-team-name { 
  font-family: 'DrukWide', sans-serif; 
  font-size: 0.9rem; 
  color: var(--bianco); 
  margin-bottom: 3px; 
  letter-spacing: 0; 
}

.season-year { 
  font-family: 'HelveticaBold', sans-serif; 
  font-size: 0.8rem; 
  color: var(--rosa-neon); 
  letter-spacing: 0; 
}

.toggle-icon { 
  color: var(--rosa-neon); 
  transition: transform 0.3s ease; 
}

.active .toggle-icon { 
  transform: rotate(90deg); 
}

.season-content { 
  display: none; 
  padding: 0; 
}

/* =========================================
5. RIGA PARTITA (MATCH ROW)
========================================= */
.match-row {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s;
}

.match-row:hover { 
  background: rgba(255, 25, 255, 0.08); 
}

.match-link {
  text-decoration: none; 
  color: inherit;
  display: flex; 
  justify-content: space-between; 
  align-items: center;
  gap: 12px;
}

.match-meta-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.match-phase {
  font-size: 0.75rem; 
  color: var(--rosa-neon); 
  text-transform: uppercase;
  white-space: nowrap; 
  font-weight: bold; 
  letter-spacing: 0;
}

.match-score-block { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
}

.team-side { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
}

.team-side img { 
  width: 24px; 
  height: 24px; 
  object-fit: contain; 
}

.team-sigla {
  font-family: 'HelveticaBold', sans-serif; 
  font-size: 0.9rem; 
  color: #ffffff;
  text-transform: uppercase; 
  letter-spacing: 0;
}

.score {
  font-family: 'DrukWide', sans-serif; 
  font-size: 1.1rem; 
  color: var(--bianco);
  margin: 0 4px; 
  min-width: 45px; 
  text-align: center; 
  letter-spacing: 0;
}

.match-stats-col {
  display: flex; 
  align-items: center; 
  justify-content: flex-end;
  gap: 15px; 
  flex-shrink: 0;
}

/* Palloni gol */
.icons-group { 
  display: flex; 
  gap: 2px; 
}

.icon-s {
  width: 22px; 
  height: 22px;
  filter: brightness(0) invert(1);
}

/* Badge voto */
.voto-badge-wrapper {
  position: relative; 
  width: 40px; 
  height: 40px;
  display: inline-flex; 
  justify-content: center; 
  align-items: center; 
  margin-right: 6px;
}

.voto-num {
  display: inline-flex; 
  justify-content: center; 
  align-items: center;
  width: 34px; 
  height: 34px; 
  border-radius: 6px;
  font-family: 'HelveticaBold', sans-serif;
  font-size: 1rem; 
  font-weight: bold;
}

/* Colori per fasce voto */
.voto-5down { background-color: #cc0000 !important; color: #ffffff !important; }
.voto-5to6 { background-color: #ff6600 !important; color: #ffffff !important; }
.voto-6to65 { background-color: #ffcc00 !important; color: #ffffff !important; }
.voto-65to7 { background-color: #99cc00 !important; color: #ffffff !important; }
.voto-7to75 { background-color: #00cc00 !important; color: #ffffff !important; }
.voto-75to85 { background-color: #00ccff !important; color: #ffffff !important; }
.voto-85to95 { background-color: #0066ff !important; color: #ffffff !important; }
.voto-95to10 { background-color: #ff19ff !important; color: #ffffff !important; }
.voto-neutro { background-color: #444 !important; color: #ffffff !important; }

.extra-icon { 
  width: 36px; 
  height: 36px; 
  object-fit: contain;
}

.corner-icon {
  position: absolute;
  width: 20px; 
  height: 20px;
}

.mp { top: -4px; left: -4px; }
.motn { top: -4px; right: -4px; }

/* Esito V/N/P in match row */
.result-char {
  font-family: 'DrukWide', sans-serif; 
  font-size: 0.9rem; 
  width: 20px; 
  text-align: center; 
  letter-spacing: 0;
}
.esito-v { color: var(--verde); }
.esito-n { color: var(--bianco); }
.esito-p { color: var(--rosso); }

.season-summary {
  padding: 15px 20px; 
  text-align: right; 
  font-size: 0.85rem; 
  color: #ffffff;
  background: rgba(0,0,0,0.4); 
  text-transform: uppercase; 
  letter-spacing: 0;
}

.no-matches { 
  padding: 20px; 
  color: #ffffff; 
  text-align: center; 
  font-style: italic; 
}

/* =========================================
6. RESPONSIVE (MOBILE)
========================================= */
@media (max-width: 768px) {
  .container {
    width: 98%;
    margin: 10px auto;
  }

  .player-header-grid {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
  }

  .trophies-container {
    margin-bottom: 10px;
  }

  .season-box {
    margin-bottom: 10px;
  }

  /* SEZIONE IDENTITÀ (foto + nome) */
  .ph-identity {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    width: 100%;
  }

  .ph-image-wrapper img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border-width: 1px;
  }

  .ph-text {
    flex: 1;
  }

  .ph-flag-role {
    font-size: 0.55rem;
    margin-bottom: 4px;
    gap: 4px;
    letter-spacing: 0;
  }

  .ph-flag-role .flag {
    width: 14px;
  }

  .ph-names {
    margin-bottom: 4px;
  }

  .ph-nome {
    font-size: 0.7rem;
    margin-bottom: 2px;
  }

  /* Cognome mobile */
  .ph-cognome {
    font-size: 1.6rem;
    line-height: 1;
  }

  .ph-cognome[data-long="true"] {
    font-size: 1.1rem !important;
    white-space: normal;
    line-height: 1.1;
  }

  /* STATS SOTTO IN DUE RIGHE */
  .ph-stats-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 0;
  }

  .stats-col {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 0;
    border: none !important;
  }

  .stat-box {
    text-align: center;
    flex: 1;
  }

  .stat-label {
    font-size: 0.5rem;
    margin-bottom: 3px;
  }

  .stat-number {
    font-size: 1.1rem;
  }

  .stat-outcome {
    justify-content: center;
    gap: 8px;
  }

  .dot {
    width: 8px;
    height: 8px;
  }

  /* PALMARES MOBILE */
  .trophies-container {
    padding: 30px 15px 15px 15px;
  }

  .section-label {
    top: 8px;
    left: 8px;
    font-size: 0.5rem;
  }

  .trophies-grid {
    justify-content: center;
    gap: 15px;
  }

  .trophy-card {
    width: 70px;
    height: auto;
  }

  .trophy-img-std {
    height: 35px;
  }

  .trophy-img-small {
    height: 22px;
  }

  .trophy-multiplier {
    font-size: 1rem;
  }

  .trophy-label {
    font-size: 0.45rem;
    margin-top: 4px;
  }

  .trophy-year {
    font-size: 0.6rem;
    text-align: center;
  }

  /* STAGIONI MOBILE */
  .season-header {
    padding: 12px 15px;
  }

  .season-team-name {
    font-size: 0.7rem;
  }

  .season-year {
    font-size: 0.65rem;
  }

  .season-summary {
    font-size: 0.65rem;
    padding: 10px 15px;
  }

  /* MATCH ROW MOBILE */
  .match-row {
    padding: 8px 10px;
  }

  .match-link {
    gap: 8px;
  }

  .match-phase {
    font-size: 0.6rem;
  }

  .team-side img {
    width: 18px;
    height: 18px;
  }

  .team-sigla {
    font-size: 0.65rem;
  }

  .score {
    font-size: 0.85rem;
    margin: 0 3px;
    min-width: auto;
  }

  .match-stats-col {
    gap: 6px;
  }

  /* PALLONI GOL MOBILE */
  .icon-s {
    width: 16px;
    height: 16px;
  }

  /* Gestione palloni multipli >= 5 */
  .icons-group.high-count {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  /* Caso 5 o 6 gol: split 3 sopra */
  .icons-group.count-5,
  .icons-group.count-6 {
    width: 58px;
  }

  /* Caso 7, 8, 9 gol: split 4 sopra */
  .icons-group.count-7,
  .icons-group.count-8,
  .icons-group.count-9 {
    width: 76px;
  }

  .voto-badge-wrapper {
    width: 30px;
    height: 30px;
    margin-right: 2px;
  }

  .voto-num {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
    border-radius: 4px;
  }

  .extra-icon {
    width: 24px;
    height: 24px;
  }

  .corner-icon {
    width: 12px;
    height: 12px;
  }

  .result-char {
    font-size: 0.7rem;
    width: 14px;
  }
}

/* Extra small */
@media (max-width: 360px) {
  .ph-image-wrapper img {
    width: 65px;
    height: 65px;
  }

  .ph-cognome {
    font-size: 1.3rem;
  }

  .stat-number {
    font-size: 1rem;
  }
}