@import '../colors';


.field-container {
    position: sticky;
    position: -webkit-sticky;
    top: 0px;
    height: calc(100vh - 70px);
    width: 100%;
    z-index: 0;
    margin-top: -80px;
}

.field-image {
    display: block;
    width: 100%;
    height: 100%;  
    z-index: 0;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 0;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        animation: popOut 0.3s forwards linear;
        border-radius: 50%;
        transform: scale(0);
    }
}

@keyframes popOut {
    0% {
        transform: scale(0);
        border-radius: 50%;
    }
    90% {
        transform: scale(1);
        border-radius: 50%;
    }

    100% {
        transform: scale(1);
        border-radius: 0%;
    }
}

.field-setting {
    position: absolute;
    z-index: 1;
    list-style: none;
    padding: 0;
    margin: 0;
    top: 5%;
    left: 0%;
    width: 100%;
    height: 90%;
    overflow: visible;
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
    transform: translateY(10%);
    pointer-events: none;
    transition-delay: 0.3s;

    &.active {
        transform: translateY(0%);
        opacity: 1;
        pointer-events: all;
    }
    
    li {
        position: absolute;
        left: 0;
        top: 0;
        z-index: 1;

        &::after {
            content: '';
            display: block;
            width: 50px;
            height: 10px;
            border-radius: 50%;
            background-color: lighten($blue-grey, 20%);
            box-shadow: 0px 2px 5px $dark-blue;
            margin-top: -5px;
        }
        
        img {
            display: block;
            margin: 0 auto;
            width: 50px;
            height: 50px;
            object-fit: cover;
            object-position: top;
            position: relative;
        }

        &:nth-child(1) {
            left: 10%;
            top: 90%;
        }

        &:nth-child(2) {
            left: 15%;
            top: 60%;
        }

        &:nth-child(3) {
            left: 15%;
            top: 30%;
        }

        &:nth-child(4) {
            left: 5%;
            top: 5%;
        }

        &:nth-child(5) {
            left: 40%;
            top: 20%;
        }

        &:nth-child(6) {
            left: 70%;
            top: 20%;
        }

        &:nth-child(7) {
            left: 80%;
            top: 40%;
        }

        &:nth-child(8) {
            left: 70%;
            top: 60%;
        }

        &:nth-child(9) {
            left: 40%;
            top: 80%;
            animation: bowlerMovement 1.5s forwards linear;
        }

        @keyframes bowlerMovement {
            0% {
                transform: translate(0, 0);
            } 100% {
                transform: translate(0, -20vh);
            }
        }

        &:nth-child(10) {
            left: 80%;
            top: 90%;
        }
        
        &:nth-child(11) {
            left: 2%;
            top: 40%;
        }

        &:nth-child(12) {
            left: 50%;
            top: 52%;
            animation: runUp 1s forwards linear;
            animation-delay: 2.8s;
        }

        @keyframes runUp {
            0% {
                transform: translate(0,0);
            } 100% {
                transform: translate(-5vw, -15vh);
            }
        }

        &:nth-child(13) {
            left: 42%;
            top: 33%;

            animation: runDown 1s forwards linear;
            animation-delay: 3s;
        }

        @keyframes runDown {
            0% {
                transform: translate(0,0);
            } 100% {
                transform: translate(7vw, 15vh);
            }
        }

        &:nth-child(14) {
            left: 39%;
            top: 82%;

            img {
                width: 20px;
                height: 20px;
            }

            &::after {
                display: none;
            }


            animation: ballMovement 5s forwards linear;
        }

        @keyframes ballMovement {
            0% {
                transform: translate(0, 0);
            } 50% {
                transform: translate(0, -35vh);
            } 100% {
                transform: translate(50vw, 10vh);
            }
        }
    }
}

.player-details {
    position: relative;
    z-index: 2;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0px 0px 5px $dark-blue;
    background-color: $dark-blue;
    left: 0;
    top: 0;

    .close-button {
        display: block;
        position: absolute;
        right: 0;
        top: 0;
        width: 40px;
        height: 40px;
        margin: 15px 5% 15px auto;
        border-radius: 50%;
        border: 1px solid $blue-grey;
        background-color: rgba($blue-grey, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 2;

        ion-icon {
            color: $blue-grey;
            font-size: 20px;
        }
    }

    &.active {
        pointer-events: all;
        opacity: 1;
        transform: translateY(100px);
    }
}

.team-selection {
    position: fixed;
    left: calc(50% - 100px);
    bottom: 20px;
    width: 200px;
    z-index: 1;
    height: 40px;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    background-color: rgba($blue-grey, 0.5);

    &.change-bg {
        background-color: rgba($blue-grey, 0.3);

        .live span {
            background-color: white;
        }
    }

    &.active {
        &::before {
            transform: translateX(120px);
        }

        button:nth-child(3) {
            color: darken($green, 10%);
        }

        button:nth-child(1) {
            color: white;
        }
    }

    &.live {
        &::before {
            transform: translateX(80px);
            width: 40px;
        }

        button:nth-child(1) {
            color: white;
        }
    }

    &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 80px;
        height: 100%;
        border-radius: 30px;
        background-color: white;
        transition: transform 0.3s, width 0.5s;
        transform: translateX(0px);
    }

    button {
        position: relative;
        width: 80px;
        border-radius: 30px;
        border-radius: 30px;
        transition: color 0.3s;
        color: darken($green, 10%);        
        height: 100%;
        background-color: transparent;
        font-weight: 700;
        letter-spacing: 1px;
        display: flex;
        align-items: center;
        justify-content: center;

        &.live {
            width: 40px;
            position: relative;

            span {
                width: 12px;
                height: 12px;
                background-color: darken($green, 10%);
                display: block;
                border-radius: 50%;

                &:before {
                    content: '';
                    left: 0;
                    top: 0;
                    height: 16px;
                    width: 16px;
                    position: absolute;
                    border-radius: 50%;
                    border: 12px solid rgba(darken($green, 10%), 0.5);
                    opacity: 0.7;
                    animation: rippleBorder 1.5s infinite;
                }
            }

            @keyframes rippleBorder {
                0% {
                    opacity: 0;
                    transform: scale(0);
                } 50% {
                    opacity: 1;
                    transform: scale(0.8);
                }
                100% {
                    opacity: 0;
                    transform: scale(0.8);
                }
            }
        }

        &:nth-child(3) {
            color: white;
        }
    }
}

.segment-holder {
    position: sticky;
    left: 0;
    top: 70px;
    z-index: 1;
    width: 100%;
    padding: 20px 0;
    background-color: $dark-blue;
    box-shadow: 0px 0px 10px -2px darken($dark-blue, 10%);
    transition: background-color 0.3s, box-shadow 0.3s;

    &.no-bg {
        background-color: transparent;
        box-shadow: 0px 0px 0px $dark-blue;
    }
}

.segments {
    position: relative;
    margin: 0 auto;
    width: 70%;
    height: 40px;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    background-color: lighten($dark-blue, 15%);
    box-shadow: 0px 0px 5px inset $dark-blue;

    &.active {
        &::before {
            transform: translateX(98%);
        }

        button:nth-child(2) {
            color: white;
        }

        button:nth-child(1) {
            color: white;
        }
    }

    &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 50%;
        height: 90%;
        top: 5%;
        border-radius: 30px;
        background-color: darken($green, 5%);
        transition: transform 0.3s;
        transform: translateX(2%);
    }

    button {
        position: relative;
        width: 50%;
        border-radius: 30px;
        border-radius: 30px;
        transition: color 0.3s;
        color: white;        
        height: 100%;
        background-color: transparent;
        font-weight: 700;
        letter-spacing: 1px;
        font-size: 1rem;

        &:nth-child(2) {
            color: white;
        }
    }
}


.score-card {
    background-color: white;
    box-shadow: 10px 10px 15px -7px darken($dark-blue, 10%);
    border-radius: 7px;
    overflow: hidden;
    width: 90%;
    margin: 30px auto;

    .container {
        width: 90%;
        margin: 0 auto;
        overflow: auto;
        padding-bottom: 20px;
    }

    header {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        margin-bottom: 10px;
        height: 50px;
        background-color: lighten($blue-grey, 32%);
        padding: 0 5%;
        position: sticky;
        left: 0;

        h5 {
            margin: 0;
            font-size: 0.9rem;
            font-weight: 500;
            color: darken($blue-grey, 30%);
        }

        img {
            margin-right: 10px;
            width: 30px;
            height: 30px;
            object-fit: contain;            
        }

        p {
            margin: 0;
            margin-left: 10px;
            font-size: 0.9rem;
            color: darken($blue-grey, 30%);
            font-weight: 700;
        }
    }

    table {
        width: 130vw;
        color: darken($blue-grey, 30%);
        font-size: 1rem;
        text-align: left;
        overflow-x: auto;
        
        thead {
            font-size: 0.9rem;

            th {
                padding: 10px 15px;
            }
        }

        tbody tr {
            
            background-color: lighten($blue-grey, 35%);
            border-bottom: 2px solid white;

            &:last-child {
                border-bottom: 0;
            }

            td {
                overflow: hidden;
                padding: 10px 15px;
    
                span {
                    font-size: 0.9rem;
                    color: darken($blue-grey, 10%);
                }

                label {
                    font-weight: 500;
                }
                
                &:nth-child(1) {
                    width: 40vw;
                }            
            }
        }
    }
}

.player-list {
    position: sticky;
    top: 0px;
    z-index: 0;
    left: 0;

    ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    li {
        display: flex;
        width: 100%;
        align-items: center;
        border-bottom: 1px solid rgba(white, 0.1);
        padding: 15px 5%;
    }

    label {
        background-color: $pink;
        color: white;
        width: 30px;
        height: 30px;
        font-size: 13px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .player-image {
        width: 60px;
        height: 60px;
        object-fit: cover;
        object-position: top;
        border-radius: 1px solid $blue-grey;
        background-color: rgba($blue-grey, 0.3);
        border-radius: 50%;
        margin: 0 auto;
    }

    .details {
        width: calc(100% - 120px);
        display: flex;
        align-items: center;
        justify-content: flex-start;

        h4 {
            margin: 0;
            font-size: 1rem;
            color: white;
            max-width: calc(100% - 80px);
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }

        img {
            width: 20px;
            margin: 0 10px;
        }
    }
}