@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

* {
    box-sizing: border-box;
}

header {
    text-align: center;
    font-family: "Fira Mono";
}

main {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.reg {
    height: 40px;
    background-color: #cee;

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

    overflow: hidden; /* for animations */

    font-family: 'Fira Mono';
    font-style: italic bold;
    font-size: small;
    color: #444;

    max-height: 90%;
    min-width: 40px;
    padding: 3px;
    border-radius: 3px;   
}

code {
    font-family: "Google Sans Code" monospace;
    font-weight: bold;
    color: #000;
}

button {
    background-color: #368;
    font-family: "Fira Mono";
    font-weight: bold;
    height: 40px;
    width: 40px;
}

button:hover {
    background-color: #257;
}

/* --- Calculator ---------------------------- */

#calc {
    padding: 10px;
    border: 1px solid black;
    border-radius: 5px;

    background-image: linear-gradient(to bottom, #57D795, #2A7B9B);

    display: grid;
    grid-template-rows: auto auto auto;
    grid-template-columns: auto auto;
    grid-template-areas: 
    "operation operation"
    "numpad operators"
    "meta meta";

    button {
        border-radius: 15px;
        outline: none;
        border: none;
        font-weight: bold;
    }
}

/* --- DISPLAY ------------------------------- */

#display {
    background-color: #4bc;
    grid-area: operation;
    padding: 5px;
    
    display: flex;
    flex-direction: column;
    gap: 5px;

    /* common horizontal div */
    div {
        padding-left: 5px;
        padding-right: 5px;
        display: flex;
    }
}

#prev-bar {
    justify-content: space-between;
    align-items: center;
    gap: 5px;
}

#input-bar {
    justify-content: end;
    align-items: center;
}

#res-box {
    max-width: 150px;
    
    justify-content: end;
}

#res-box:hover {
    background-color: #bdd;
}

#in-box {
    background-color: #eee;
    height: 45px;
    min-width: 100px;
    max-width: 215px;

    justify-content: end;

    font-size: large;
}

#in-box:hover {
    background-color: #ddd;
}


/* --- INPUT --------------------------------- */

#numpad {
    background-color: #39b;
    grid-area: numpad;
    display: flex;
    gap: 5px;
    padding: 5px;
    
    div {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    button {
        color: #cff;
    }
}

#operators {
    background-color: #39b;
    grid-area: operators;
    display: flex;
    gap: 5px;
    padding: 5px;

    div {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    button {
        color: #5fc;
        font-size: large;
        font-weight: 600;
    }
}

#meta {
    background-color: #4bd;
    grid-area: meta;
    display: flex;
    justify-content: space-evenly;
    gap: 5px;
    padding: 5px;

    button {
        color: #ffc;
        width: 30%;
        height: 40px;
    }
}

/* --- Center -------------------------------- */

#center {
    max-height: 100%;
}

#center-container {
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    gap: 5px;

    .reg {
        min-width: 100px;
    }

    p {
        font-size: xx-large;
    }
}

#err-box {
    justify-content: start;
}

#swap-box {
    justify-content: start;
}

/* --- History ------------------------------- */

#history {
    border: 1px solid black;
    max-height: 100%;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

#list-container {
    height: 300px;
    overflow-y: scroll;

    ul {
        list-style: none;
        margin-top: 0px;
        padding: 10px;
        min-width: 220px;

        li {
            font-family: "Fira Mono";
            font-weight: bold;
            padding-left: 20px;
            width: 200px;
            overflow: hidden;

            em {
                font-weight: normal;
                color: #666;
            }
        }

        li:nth-last-child(odd) {
            background-color: #cef; 
        }

        li:hover {
            background-color: #eee;
        }

        li:nth-last-child(odd):hover {
            background-color: #bde;
        }
    }
}

#keyH {
    border-radius: 5px;
    outline: none;
    padding: 10px;
    width: 100%;
    background-color: #afc;
}

#keyH:hover {
    background-color: #9db;
}

/* --- Footer -------------------------------- */

footer {
    font-family: 'Open Sans';
    display: flex;
    flex-direction: column;
    align-items: center;

    padding-bottom: 100px;

    div {
        max-width: min(80%, 800px);
    }
}

