@import '../colors';


.commentary-container {
    padding-bottom: 60px;
    width: 100%;
    z-index: 0;
    position: relative;

    header {
        padding: 0 5%;
        color: $green;
        font-size: 14px;
    }

    .score-card {
        box-shadow: 0px 0px 15px -6px darken($brand-blue, 10%);
        margin: 0px auto 30px;
        position: sticky;
        position: -webkit-sticky;
        top: 140px;
        z-index: 1;
    }

    .score-card .team {
        header {
            background-color: white;
            margin-bottom: 0;

            &:first-child {
                border-bottom: 1px solid rgba($brand-blue, 0.1);
            }

            h5 {
                margin-right: 10px;
            }
        }
    }

    ul {
        list-style: none;
        color: darken($brand-blue, 20%);
        line-height: 1.5;
        padding: 0;
    }

    li {
        padding: 10px 5% 10px 5px;
        display: flex;
        border-bottom: 1px solid rgba($brand-blue, 0.2);
        justify-content: space-between;
    }

    .over-data {
        width: 50px;

        label {
            display: block;
            font-size: 16px;
            font-weight: 600;
            text-align: center;
        }

        span {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: $brand-blue;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            color: white;
            font-size: 14px;
            margin: 10px auto;

            &.boundary {
                background-color: $green;
            }

            &.six {
                background-color: $green;
            }

            &.wicket {
                background-color: lighten($brand-red, 15%);
            }
        }
    }

    .comment {
        width: calc(100% - 55px);
        margin: 0;

        p {
            margin: 0;
        }

        .small-stats {
            margin-top: 10px;
        }
    }
}

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

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

.player-details {
    position: fixed;
    z-index: 2;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0px 0px 5px darken($brand-blue, 30%);
    background-color: darken($brand-blue, 30%);
    left: 0;
    top: 20%;
    height: 80%;
    overflow: auto;
    transform: translateY(50vh);
    opacity: 0;

    animation: riseUp 0.3s forwards;

    @keyframes riseUp {
        from {
            transform: translateY(50vh);
            opacity: 0;
        } to {
            transform: translateY(0vh);
            opacity: 1;
        }
    }

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

        ion-icon {
            color: lighten($brand-blue, 10%);
            font-size: 22px;
        }
    }

    &.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: linear-gradient(to right, lighten($brand-red, 15%), darken($brand-blue, 20%) 80%);

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

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

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

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

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

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

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

    &::before {
        content: '';
        position: absolute;
        left: 2px;
        top: 2px;
        width: 80px;
        height: calc(100% - 4px);
        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: linear-gradient(to bottom, white 50%, transparent);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.segments {
    position: relative;
    margin: 0 auto;
    width: 70%;
    height: 40px;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    background-color: $brand-blue;
    box-shadow: 0px 0px 5px inset $brand-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($brand-blue, 10%);
    border-radius: 7px;
    overflow: hidden;
    width: 90%;
    margin: 10px auto 30px;

    .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;
        padding-bottom: 80px;
    }

    li {
        display: flex;
        width: 100%;
        align-items: center;
        border-bottom: 2px solid rgba($brand-blue, 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%;
        margin-right: 10px;
    }

    .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: $brand-blue;
            max-width: calc(100% - 40px);
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }

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