.comparador-tabla tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.comparador-form {
    background: rgba(33, 33, 33, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2vw;
    padding: 2vw 4vw;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2vw;
    margin: 2vw auto 3vw;
    width: 80%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.jugador-select {
    flex: 1;
    display: flex;
    justify-content: center;
    width: 100%;
}

.jugador-select input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 1vw 1.5vw;
    border-radius: 1vw;
    font-size: 1.2vw;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
}

.jugador-select input[type="text"]:focus {
    border-color: var(--color-green);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 15px rgba(0, 168, 120, 0.2);
}

.comparador-container {
    display: flex;
    justify-content: center;
    gap: 3vw;
    align-items: stretch;
    margin: 2vw auto;
}

.vertical-line {
    display: none;
}

.comparador-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 1vw;
    background: rgba(33, 33, 33, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1vw;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.comparador-tabla tbody tr:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.player-image td {
    text-align: center;
}

.player-image img {
    width: 10vw;
    height: 15vw;
    object-fit: cover;
    display: inline-block;
}

.player-image img.placeholder {
    width: 10vw;
    height: 15vw;
    object-fit: contain;
}

.comparador-tabla th,
.comparador-tabla td {
    padding: 0.5vw;
}

.vs-button {
    background: linear-gradient(135deg, var(--color-green), #0a5f46);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 5vw;
    height: 5vw;
    font-size: 1.5vw;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 168, 120, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.vs-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(0, 168, 120, 0.6);
}

/* Tables showing stats by league and season */
.season-tables {
  position: relative;
}

.best {
  color: var(--color-green);
  font-weight: bold;
}

.best::after {
  content: " ✓";
  font-size: 0.8em;
  opacity: 0.8;
}

/* Graph container for league by league charts */
.league-chart {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 2 / 1;
  margin-top: 5%;
}

/* Wrapper for each player's table and chart */
.player-block {
  width: 45%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5vw;
}

.player-block table.comparador-tabla {
    width: 100%;
}

/* Pie charts for season percentages */
.season-graphs {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 1vw;
  margin-bottom: 2vw;
}

.pie-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.season-pie {
  width: 100% !important;
  max-width: 180px;
  height: auto !important;
  aspect-ratio: 1 / 1;
}

.diff-up {
  color: var(--color-green);
  font-weight: bold;
}

.diff-down {
  color: var(--color-red);
  font-weight: bold;
}

/* Desktop/Mobile wrappers */
.mobile-wrapper {
    display: none;
}
.desktop-wrapper {
    display: block;
}

/* -------- Responsive styles -------- */

@media (max-width: 1024px) {
  .player-block {
      width: 48%;
  }

  .comparador-tabla {
    font-size: 1.8vw;
  }

  .player-image img,
  .player-image img.placeholder {
    width: 15vw;
    height: 20vw;
  }

  .vs-button {
    font-size: 5vw;
    width: 10vw;
    height: 10vw;
  }
}

@media (max-width: 600px) {
  .desktop-wrapper {
      display: none !important;
  }
  .mobile-wrapper {
      display: flex !important;
      flex-direction: column;
      gap: 4vw;
  }

  /* mobile cards */
  .mobile-merged-card {
      background: rgba(33, 33, 33, 0.6);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-radius: 4vw;
      padding: 3vw;
      width: 100%;
      margin: 0 auto;
      box-shadow: 0 8px 24px 0 rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.1);
      display: flex;
      flex-direction: column;
      align-items: center;
  }

  .mobile-headers {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 100%;
      margin-bottom: 4vw;
  }

  .mobile-player-head {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 40%;
  }

  .mobile-player-head img {
      width: 25vw;
      height: 35vw;
      object-fit: cover;
      border-radius: 2vw;
      margin-bottom: 2vw;
  }
  .mobile-player-head img.placeholder {
      object-fit: contain;
  }

  .m-name {
      font-size: 3.5vw;
      text-align: center;
      margin: 0 0 1vw;
  }
  .m-tag {
      font-size: 2.5vw;
      opacity: 0.6;
      text-transform: uppercase;
  }

  .mobile-vs-badge {
      background: linear-gradient(135deg, var(--color-green), #0a5f46);
      color: #fff;
      font-weight: 800;
      font-size: 3.5vw;
      padding: 1.5vw 3vw;
      border-radius: 4vw;
      box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  }

  .mobile-merged-table {
      width: 100%;
      font-size: 3.2vw !important;
  }
  .mobile-merged-table th, .mobile-merged-table td {
      text-align: center;
      padding: 2vw 1vw !important;
      border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .mobile-merged-table th:first-child, .mobile-merged-table td:first-child {
      text-align: left;
      font-weight: 600;
      opacity: 0.9;
      border-right: 1px solid rgba(255,255,255,0.1);
  }
  .mobile-merged-table .section-title {
      background: rgba(0,0,0,0.2) !important;
      text-align: center !important;
      font-size: 4vw !important;
      padding: 3vw 1vw !important;
      border: none !important;
      color: var(--color-green) !important;
      margin-top: 2vw;
  }

  .mobile-season-grid {
      display: flex;
      width: 100%;
      justify-content: space-between;
  }
  .mobile-season-col {
      width: 48%;
      display: flex;
      flex-direction: column;
      align-items: center;
  }
  .player-mini-heading {
      margin: 0 0 2vw;
      font-size: 3.5vw;
      text-align: center;
  }
  .mobile-mini-pie {
      width: 100% !important;
      max-width: 100px;
  }

  .comparador-form {
      flex-direction: column;
      width: 90%;
      padding: 4vw;
      border-radius: 4vw;
      gap: 3vw;
  }
  
  .jugador-select input[type="text"] {
    font-size: 3.5vw;
    padding: 2.5vw;
    border-radius: 2vw;
  }
  
  .vs-button {
    font-size: 4vw;
    width: 12vw;
    height: 12vw;
  }
  
  .player-block {
      width: 100%;
  }

  .comparador-container,
  .advanced-tables {
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 4vw;
  }
  .comparador-tabla {
    width: 90vw;
    font-size: 2vw !important;
    margin-bottom: 0;
  }
  .comparador-tabla th,
  .comparador-tabla td {
      font-size: 2.5vw !important;
  }
  .player-image img,
  .player-image img.placeholder {
    width: 30vw;
    height: 40vw;
  }
  .league-chart {
    aspect-ratio: 2 / 1;
  }
  .vs-button {
    font-size: 7vw;
    width: 14vw;
    height: 14vw;
    margin: 0 2vw;
    align-self: center;
  }
  .pie-item label, .pie-item span, .pie-item {
    font-size: 2vw !important;
    margin: 0;
    padding: 0;
  }

  .pie-label {
    font-size: 4vw !important;
    margin: 0;
    padding: 0;
  }

  .pie-item {
    width: 60vw !important;
    max-width: 240px;
  }

  .season-pie {
    width: 100% !important;
    height: auto !important;
  }
  .season-graphs {
    flex-direction: column !important;
    width: 100% !important;
    align-items: center !important;
    gap: 8vw !important;
  }
  .season-graphs .pie-item {
    align-items: center !important;
    margin-bottom: 2vw !important;
  }
}