.squad {
    background-color: green;
    background-image: url("../assets/football-field-vertical.jpg");
    width: 100%;
    position: relative;
    background-size: cover;
    background-position: bottom 0 left 50%;
    aspect-ratio: 1 / 1.1;
}

.squad .player {
    position: absolute;
    width: 100px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.4);
    /*backdrop-filter: blur(5px);*/
    border: solid 1px white;
    border-radius: 1rem;
    transform: translateX(-60px) translateY(35px);
    color: white;
    text-align: center;
    line-height: 40px;
    font-size: 12px;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
}

.player .player-image {
    transform: translateY(-90%);
}

.player .position-badge {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(-9px) translateY(-13px);
    width: 25px;
    height: 25px;
    background-color: rgb(54 70 45);
    /* border: solid 1px #C0C0C0; */
    border-radius: 50%;
    color: white;
    line-height: 25px;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
    /*backdrop-filter: blur(5px);*/
    font-size: 11px;
}

.player .freshness-badge {
    display: block;
    position: absolute;
    bottom: -19px;
    left: 0;
    transform: translateX(-9px) translateY(-13px);
    width: 36px;
    height: 18px;
    background-color: rgb(0 0 0 / 66%);
    border-radius: 3px;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
    font-size: 12px;
    line-height: 18px;
}

.player .name {
    display: block;
    font-weight: normal;
    font-size: 12px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

.player .level-badge {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    transform: translateX(10px) translateY(20px);
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
}

.squad .player:hover {
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.5);
}

.squad .player.GK {
    top: 85%;
    left: 50%;
    z-index: 6;
}

.squad .player.LD {
    top: 65%;
    left: 15%;
    z-index: 5;
}

.squad .player.CD {
    top: 70%;
    left: 50%;
    z-index: 5;
}

.squad .player.RD {
    top: 65%;
    left: 85%;
    z-index: 5;
}

.squad .player.CM {
    top: 40%;
    left: 50%;
    z-index: 3;
}

.squad .player.LM {
    top: 40%;
    left: 15%;
    z-index: 3;
}

.squad .player.RM {
    top: 40%;
    left: 85%;
    z-index: 3;
}

.squad .player.DM {
    top: 55%;
    left: 50%;
    z-index: 4;
}

.squad .player.OM {
    top: 25%;
    left: 50%;
    z-index: 2;
}

.squad .player.CA {
    top: 10%;
    left: 50%;
    z-index: 1;
}

.squad .player.RA {
    top: 10%;
    left: 75%;
    z-index: 1;
}

.squad .player.LA {
    top: 10%;
    left: 25%;
    z-index: 1;
}


/* Lineup container: pitch + bench side by side */
.lineup-container {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: center;
    max-height: 80vh;
}

.lineup-pitch {
    flex: 1;
    min-width: 0;
    /* Cap width so the squad (aspect-ratio 1/1.1) never exceeds 80vh in height */
    max-width: calc(80vh / 1.1);
}

/* Bench panel */
.bench {
    width: 140px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4rem;
    padding: 1rem;
    background-color: #222;
    border-radius: 0.5rem;
    overflow-y: auto;
    min-height: 0;
    max-height: 80vh;
}

.bench-title {
    color: white;
    text-align: center;
    margin: 0;
    font-size: 20px;
    opacity: 0.8;
}

.bench-empty {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-size: 12px;
    padding: 1rem 0;
}

.bench .player {
    position: relative;
    width: 100px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.4);
    border: solid 1px white;
    border-radius: 1rem;
    color: white;
    text-align: center;
    line-height: 40px;
    font-size: 12px;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
    margin: 0 auto;
    transform: none;
    cursor: grab;
}

.bench .player:hover {
    background-color: rgba(0, 0, 0, 0.6);
}

.bench .player.dragging {
    opacity: 0.4;
}

.bench .player.drop-target-highlight {
    border-color: #0f0;
    background-color: rgba(0, 100, 0, 0.5);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.bench .player .player-image {
    transform: translateY(-80%);
}

@media screen and (max-width: 991px) {
    .squad .player {
        transform: translateX(-52px) translateY(12px) scale(0.8);
    }
}

@media screen and (max-width: 768px) {
    #squad {
        width: calc(100% + 4rem);
        margin: 0 -2rem;
    }

    .bench {
        display: none;
    }

}

@media screen and (max-width: 575px) {
    .squad .player {
        transform: translateX(-52px) translateY(12px) scale(0.6);
    }
}
