$colors: (
    primary: #000,
    menues: #000016,
    textColors: #f5f5f5,
    highlighted: gold,
);

// Variables
$spacing: 1px; // Letter spacing
$center: translate(-50%, -50%);
$mainFont: "Press Start 2P";

// Function
@function color($colorName) {
    @return map-get($colors, $colorName);
}

// Mixin - used for media queries
$desktopBigger: 1920px;

@mixin desktopBigger {
    @media (min-width: #{$desktopBigger}) {
        @content;
    };
} 

body{
    background-color: color(primary);
    overflow: hidden;
    color: color(textColors);

    .mainMenu-fade{
        opacity: 0;
    }

    .main-menu_buttons:hover{
        animation: buttonsAnimation 0.5s ease forwards infinite;
    }
    
    button {
        outline: none;
    }
}

// Main menu
.main-menu{
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 2.5s ease;
    z-index: 3;
    opacity: 1;
    overflow: hidden;

    .title{
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        *{ // All items
            margin: 15px 0;
        }
        h1{
            text-align: center;
            font-family: $mainFont;
            font-size: 50px;
            color: color(textColors);
            letter-spacing: $spacing;
            margin: 0 auto;
            margin-bottom: 40px;

            @include desktopBigger {
                font-size: 70px;
            }
        }
        .mainButtons{
            font-size: 14px;
            font-family: $mainFont;
            border: none;
            background: none;
            color: #f5f5f5;
            letter-spacing: $spacing;
            cursor: pointer;
            z-index: 3;
            outline: none;
            transition: 0.3s ease;

            @include desktopBigger {
                font-size: 18px;
            }
        }
        .mainButtons:hover{
            color: color(highlighted);
        }
        #copyright{
            margin-top: 80px;
            font-family: $mainFont;
            font-size: 8px;
            color: color(textColors);
            justify-self: flex-end;

            @include desktopBigger {
                font-size: 14px;
            }
        }
        .soundControl{
            cursor: pointer;
        }
    }
}

.aboutMenu{
    display: none;
    padding: 15px;
    width: 450px;
    height: auto;

    position: absolute;
    top: 50%;
    left: 50%;
    transform: $center;

    color: color(textColors);
    background-color: color(menues);
    z-index: 3;
    border: 1px solid #dddddd30;

    text-align: center;
    font-family: $mainFont;
    font-size: 12px;
    letter-spacing: 2px;
    line-height: 15px;

    @include desktopBigger {
        width: 600px;
        line-height: 20px;
    }

    h3{
        color: color(highlighted);
        font-size: 20px;
    }

    p{
        padding: 25px;

        @include desktopBigger {
            font-size: 18px;
        }
    }

    a{
        color: color(highlighted);
        text-decoration: none;
    }
}

.highscoresList-menu{
    display: none;
    width: 400px;
    height: auto;
    padding: 20px;
    border: 1px solid #f5f5f535;

    font-family: $mainFont;
    color: color(textColors);
    background-color: color(menues);

    position: absolute;
    top: 50%;
    left: 50%;
    transform: $center;

    z-index: 3;

    h3{
        font-size: 20px;
        letter-spacing: 2px;
        color: color(highlighted);
        margin-bottom: 20px;
    }

    #theName{
        color: color(highlighted);
    }

    p{
        font-size: 12px;
        margin: 10px 0;
    }

    .highscoreList-items{
        width: 100%;
        padding: 0 5px;

        display: flex;
        justify-content: space-between;
        align-items: center;
        
        font-size: 12px;
        list-style-type: none;

        * {
            margin: 3px 0;
        }
    }

    #clearList {
        display: none;
    }
    
    #clearList:hover{
        color: #bd0e08;
    }
}

// LOADING MENU
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: $center;

    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3;

    font-family: $mainFont;

    .loading-text{
        font-size: 12px;
        color: color(textColors);
        margin-bottom: 10px;

        @include desktopBigger {
            font-size: 18px;
        }
    }

    .loading-bar{
        width: 200px;
        height: 20px;
        border: 1px solid grey;

        .loading-bar_fill {
            width: 0%;
            height: 100%;
            background-color: #f5f5f5;
        }
    }

    .info{
        margin: 30px 0px;

        h2 {
            margin: 10px 0;

            font-size: 16px;
            text-align: center;

            color: color(highlighted);
            letter-spacing: 2px;

            @include desktopBigger {
                font-size: 22px;
                letter-spacing: 3px;
            }
        }

        p {
            color: color(textColors);
            font-size: 10px;
            margin: 5px 0;

            @include desktopBigger {
                font-size: 18px;
            }
        }
    }
}

// CONTAINER
.container {
    width: 1280px;
    height: 500px;
    position: relative;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;

    position: absolute;
    top: 50%;
    left: 50%;
    transform: $center;
    overflow: hidden;

    canvas {
        display: none;
        border: 2px solid #dddddd10;
        
        position: absolute;
        left: 50%;
        top: 50%;
        transform: $center;  
    }
    
    // Health / shield status
    .containerText{
        width: 60px;
        height: 12px;
        padding: 5px;

        border: 2px solid #860905;
        border-radius: 25px;

        background-color: PeachPuff;
        color: #111;

        display: flex;
        justify-content: flex-end;
        align-items: center;
        position: absolute;
        bottom: 7px;
        left: 15px;
        z-index: -1;

        font-size: 12px;
        font-family: $mainFont;
    }

    .health-container {
        display: none;
        position: absolute;
        bottom: 5px;
        left: 5px;
        z-index: 3;

        img{
            z-index: 2;
        }
    }

    .shield-container{
        display: none;
        position: absolute;
        bottom: 5px;
        left: 90px;
        z-index: 3;

        img {
            z-index: 2;
        }
    }

    .countdown {
        display: none;
        font-family: $mainFont;
        font-size: 30px;
        color: color(textColors);
        text-shadow: 3px 3px rgb(168, 33, 33);
        z-index: 3;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: $center;
    }

    .emptyWarning-text{
        display: none;

        font-family: $mainFont;
        font-size: 22px;
        letter-spacing: 3px;

        color: color(textColors);
        text-shadow: 4px 4px #860905;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: $center;
        z-index: 3;
    }

    .emptyWarning-textActive{
        display: block;
        animation: overheatAnimation 0.6s ease forwards infinite;
    }

    .emptyWarning-highscore{
        display: block;
        animation: highscoreAnimation 1.25s ease forwards infinite;
    }

    .notificationsContainer{
        display: flex;
        justify-content: center;
        align-items: center;

        position: absolute;
        left: 50%;
        bottom: 5px;
        transform: $center;

        .notification {
            padding: 5px;
            width: 300px;
            height: 40px;

            display: flex;
            justify-content: center;
            align-items: center;
            
            transform: translateY(100px);

            font-size: 12px;
            font-family: $mainFont;

            i {
                color: #e1302a;
            }

            p {
                margin-left: 5px;
                color: color(textColors);
            }

            .health {
                color: color(textColors);
            }

            .shield {
                color: #1aeb71;
            }

            .timer {
                color: gold;
            }
        }
        .activeNotification {
            animation: notification 3s ease forwards;
        }
    }
}

// GAME MENU (MENU, KILLS, TIMER, LEVEL)
.menu {
    display: none;
    width: 1250px;
    opacity: 0;

    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top:20px;
    left: 50%;
    transform: $center;

    z-index: 3;
    transition: 0.75s ease;
    
    color: color(textColors);
    font-family: $mainFont;

    #pauseGame {
        cursor: pointer;
    }

    .time {
        width: 150px;
        display: flex;
        justify-content: center;
        align-items: center;
        * {
            margin: 0 3px;
        }

        i {
            font-size: 30px;
        }

        #timerDisplay {
            font-size: 17px;
            letter-spacing: 2px;
            color: color(highlighted);
            font-family: $mainFont;
        }

        #timerDisplay.timeLow{
            color: #b30d07;
            font-size: 22px;
        }
    }

    .timeShake{
        animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
        transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        perspective: 1000px;
    }

    .level-container{
        width: 350px;
        padding: 3px;

        display: flex;
        justify-content: space-between;
        align-items: center;

        font-size: 14px;
        
        .levelTextActive {
            animation: notifyLevelUp 0.5s ease forwards infinite;
        }
        .level-bar {
            width: 200px;
            height: 25px;

            display: flex;
            justify-content: center;
            align-items: center;

            border: 2px solid #f5f5f520;
            border-radius: 3px;

            position: relative;
            overflow: hidden;

            p {
                color: #f5f5f5;
                z-index: 9999;
            }

            .level-bar_fill{
                position: absolute;
                top: 0;
                left: 0;

                width: 0%;
                height: 100%;

                transition: 0.3s ease;

                border-top-left-radius: 3px;
                border-bottom-left-radius: 3px;

                background-color: #b30d07;
            }
        }
    }
}

.menuActive{
    opacity: 1;
}

// OVERHEAT BAR
.overheat-container{
    display: none;
    padding: 5px;

    position: absolute;
    left: 16%;
    bottom: 3px;
    transform: translate(-16%);

    background-color: rgba(0,0,0,0.95);
    z-index: 3;

    flex-direction: column;
    justify-content: center;
    align-items: center;

    transition: 0.5s ease;

    p {
        text-align: center;
        font-family: $mainFont;
        font-size: 12px;
        letter-spacing: 2px;
        color: goldenrod;
    }

    .overheat-bar{
        width: 140px;
        height: 25px;

        display: flex;
        justify-content: center;
        align-items: center;

        * {
            margin: 0px 2px;
        }

        .overheat-bar_block:nth-child(1) {
            margin-left: -5px;
        }

        .overheat-bar_block{
            width: 10px;
            height: 20px;
            background-color: #fff;
        }

        // BLOCKS PHASES
        .greenPhase{
            width: 10px;
            height: 20px;
            background-color: #2ECC40;
        }
        .yellowPhase{
            width: 10px;
            height: 20px;
            background-color: #FFDC00;
        }
        .redPhase{
            width: 10px;
            height: 20px;
            background-color: #b30d07;
        }
    }
}

// GAME OVER MENU
.game--over{
    display: none;
    width: 420px;
    height: auto;
    padding: 20px;
    background-color: #000016;

    text-align: center;
    color: color(textColors);
    font-family: $mainFont;
    font-size: 12px;
    
    border: 1px solid #f5f5f535;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: $center;

    z-index: 3;

    #message{
        margin: 10px 0;
        font-family: $mainFont;
        font-size: 12px;
    }

    .newHighscore-input{
        width: 340px;
        height: auto;
        padding: 15px;
        margin: 0 auto;

        display: none;
        justify-content: center;
        align-items: center;
        flex-direction: column;

        z-index: 3;

        * {
            margin: 5px 0;
        }

        input {
            background-color: #010120;
            border: 1px solid #f5f5f535;
            padding: 5px;

            color: color(textColors);
            font-family: $mainFont;
            font-size: 10px;

            outline: none;
        }

        #scoreText{
            font-size: 12px;
        }
    }

    .newHighscore-notification{
        color: #f5f5f5;
        text-shadow: 4px 4px #860905;
        animation: highscoreAnimation 1.25s ease forwards infinite;
    }

    .scores{
        margin-top: 5px;
        text-align: left;

        span {
            color: color(highlighted);
            font-size: 15px;
        }

        * {
            margin: 10px 0;
        }

        #finalScore, #highscore{
            color: color(highlighted);
        }
    }

    .gameOverBtn{
        display: inline-block;
        margin-top: 10px;  
        padding: 5px 10px;

        background: none;
        border: none;

        color: color(textColors);
        font-family: $mainFont;
        font-size: 18px;


        cursor: pointer;
        border-radius: 1px;
    }

    .gameOverBtn:hover{
        text-shadow: 3px 3px rgb(161, 9, 9);
    }
}

// PAUSE MENU
.pause--menu{
    display: none;
    width: 250px;
    height: 180px;
    padding: 10px;
    background-color: color(menues);

    color: color(textColors);
    text-align: center;
    font-family: $mainFont;

    flex-direction: column;
    justify-content: center;
    align-items: center;

    border: 2px solid #dddddd30;

    position: absolute;
    top: 50%;
    left: 50%;
    transform: $center;
    z-index: 9;

    h3{
        font-size: 19px;
        margin: 20px 0;
        animation: pauseTitle 0.8s ease infinite forwards;
    }

    p {
        margin: 10px 0;
        cursor: pointer;
    }
    p:hover {
        color: color(highlighted);
        text-shadow: 2px 2px rgb(161, 9, 9);
    }
}

// SETTINGS MENU
.settings-menu{
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    width: 350px;
    height: 400px;
    background-color: color(menues);
    border: 1px solid #f5f5f535;
    padding: 15px;

    z-index: 10;

    color: color(highligh);
    font-family: $mainFont;
    font-size: 12px;
    
    position: absolute;
    left: 50%;
    top: 50%;
    transform: $center;
    
    h2 {
        font-size: 22px;
        margin-bottom: 10px;
        color: color(highlighted);
        letter-spacing: 3px;
        animation: settingsText 1s ease forwards infinite;
    }

    h3 {
        color: color(textColors);
    }

    button {
        background: none;
        border: none;

        font-size: 14px;
        font-family: $mainFont;
        color: color(textColors);

        cursor: pointer;
        margin-top: 10px;
        transition: 0.35s ease;
    }

    button:hover{
        color: color(highlighted);
        text-shadow: 2px 2px #860905
    }

    .settings-music, .settings-sfx{
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 320px;
    }

    * {
        margin: 5px 0;
    }

    .directionControl {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 320px;

        * {
            margin: 5px 0;
        }
    }

    input{
        width: 100px;
        cursor: pointer;
        margin: 2px 0;
    }

    input[type="text"] {
        width: 100px;
        cursor: text;
        background: none;
        border: none;
        border-bottom: 1px solid #f5f5f5;

        font-family: $mainFont;
        color: color(textColors);
        text-align: right;
        font-size: 10px;

        outline: none;

        transition: 0.3s ease;
        opacity: 0.2;
    }

    input[type="text"]:focus {
        opacity: 1;
        border-bottom: 2px solid color(highlighted);
        padding: 5px;
    }

    .muteContainer {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        height: 20px;
        margin-left: 5px;
        font-size: 14px;
        color: color(highlighted);

        img {
            cursor: pointer;
        }
    }
}