/* to delete number arrows in the input  */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    margin: 0;
    /* <-- Apparently some margin are still there even though it's hidden */
}

* {
    font-family: 'Space Mono', monospace;
    font-size: 24px;
}

/* general styles */
body {
    background-color: hsl(185, 41%, 84%);
    font-size: 24px;
}

main {
    width: 55rem;
    height: 25rem;
    margin: 16rem auto 0 auto;
    padding: 2.5rem;
    background-color: hsl(0, 0%, 100%);
    border-radius: 2.6rem;
    box-shadow: 5px 5px 30px 5px rgba(0, 0, 0, 0.1);
    display: flex;
}

.logo {
    width: 8rem;
    position: absolute;
    top: 10%;
    left: 47.5%;
    width: 5rem;
}

/* form styles */
form {
    width: 50%;
}

.form-group:not(:last-child) {
    margin-bottom: 4rem;
}

.form-label {
    display: block;
    font-size: 1rem;
    color: hsl(186, 14%, 43%);
    margin-bottom: .5rem;
}

.tip-custom,
.form-input {
    padding: .5rem;
    border: none;
    border-radius: .2rem;
    background-color: hsl(180, 37%, 97%);
    color: hsl(183, 100%, 15%);
    text-align: right;
    width: 90%;
    height: 1.7rem;
    background-position: 3%;
}

.tip-custom:focus,
.form-input:focus {
    outline: 2px solid #26c0ab;
}

#bill {
    background-image: url(../images/icon-dollar.svg);
    background-repeat: no-repeat;

}

/* selection of tip size */
.tip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.tip-option {
    float: left;
    margin: 0 5px 0 0;
    width: 100px;
    height: 40px;
    position: relative;
}

.tip-box,
.tip-label {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
}

.tip-label {
    padding: 5px;
    cursor: pointer;
    z-index: 90;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: hsl(183, 100%, 15%);
    color: hsl(0, 0%, 100%);
    border-radius: 5px;
    height: 2.5rem;
}

.tip-label:hover {
    background-color: hsl(173, 61%, 77%);
}

.tip-grid input[type="radio"]:checked+label {
    background-color: hsl(172, 67%, 45%);
    color: hsl(183, 100%, 15%);
}

.tip-custom {
    width: 85%;
    text-align: center;
    font-size: 1.3rem;
    height: 2.2rem;
}

#people-num {
    background-image: url(../images/icon-person.svg);
    background-repeat: no-repeat;
}

/* cheque styles */

.cheque {
    background-color: hsl(183, 100%, 15%);
    width: 50%;
    padding: 2rem;
    border-radius: 2.6rem;
    position: relative;
}

.cheque-amount,
.cheque-total {
    display: flex;
    justify-content: space-between;
}

.cheque-amount {
    margin-bottom: 4rem;
}

.cheque-title {
    color: hsl(0, 0%, 100%);
    font-size: 1.2rem;
    letter-spacing: .1rem;
    margin-top: .5rem;
}

.cheque-sub {
    color: hsl(183, 21%, 52%);
    font-size: 1rem;
    margin-top: .4rem;
}

.sum {
    color: hsl(172, 67%, 45%);
    font-size: 3rem;
}

.cheque-button {
    width: 87%;
    padding: 5px;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    position: absolute;
    bottom: 2rem;
    background-color: hsl(172, 67%, 45%);
    color: hsl(183, 100%, 15%);
    text-transform: uppercase;
}

.cheque-button:hover {
    background-color: hsl(173, 61%, 77%);
}

/* validation */

small {
    font-size: 1rem;
    position: absolute;
    left: 48.7rem;
    color: hsl(15, 69%, 66%);
    visibility: hidden;
}

.error {
    outline: 2px solid hsl(15, 69%, 66%);
}

.success {
    outline: 2px solid hsl(172, 32%, 51%);
}


/* MOBILE */

@media only screen and (max-width: 450px) {

    main {
        margin: 10rem auto 0;
        flex-direction: column;
        width: auto;
        height: auto;
        overflow: hidden;
    }

    .form-input {
        width: 18rem;
    }

    .logo {
        left: 10rem;
    }

    form {
        margin-bottom: 3rem;
    }

    small {
        font-size: .8rem;
        position: absolute;
        left: 15rem;
        color: hsl(15, 69%, 66%);
        visibility: hidden;
    }

    .tip-grid {
        width: 18rem;
        grid-template-columns: repeat(2, 1fr);
    }

    .tip-custom, .tip-label {
        width: 8rem;
    }

    .cheque {
        width: 84%;
        height: 10rem;
    }

    .cheque-title {
        font-size: 1rem;
        margin-top: .1rem;
    }

    .cheque-sub {
        font-size: .8rem;
        margin-top: .2rem;
    }

    .sum {
        font-size: 2rem;
    }

    .cheque-amount {
        margin-bottom: 2rem;
    }

    .cheque-button {
        height: 2rem;
        font-size: 1rem;
        right: 1rem;
    }
}