@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root
{
    --green-400: hsl(172, 67%, 45%);
    --green-900: hsl(183, 100%, 15%);
    
    --grey-600: hsl(180, 25%, 32%);
    --grey-500: hsl(186, 14%, 43%);
    --grey-400: hsl(184, 14%, 56%);
    --grey-200: hsl(185, 41%, 84%);
    --grey-50: hsl(189, 47%, 97%);
    --white: hsl(0, 100%, 100%);
}

*
{
    padding: 0;
    margin: 0;
    box-sizing: border-box;

    font-family: "Space Mono", monospace;
}

body
{
    width: 100%;
    min-height: 100vh;

    background-color: var(--grey-200);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4rem;
}

.form
{
    width: clamp(20rem, 12rem + 50vw, 70rem);
    height: fit-content;
    
    display: flex;
    flex-direction: column;

    background-color: white;

    border-radius: 20px;

    padding: 2rem;

    gap: 2rem;
}

.desktop__left__side
{
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.bill__input,
.people__input
{
    position: relative;

    display: flex;
    flex-direction: column;

    justify-content: center;

    gap: 0.5rem;

    color: var(--grey-600);

    font-weight: bold;

    width: 100%;

    input
    {
        width: 100%;

        background-color: var(--grey-50);
        
        padding: 1.5rem 1rem;
        
        height: 2.5rem;
        
        border: 0;
        border-radius: 5px;

        text-align: end;
        font-weight: bold;
        font-size: 1.5rem;
    }

    .dollar__icon
    {
        width: 32px;

        object-fit: contain;

        aspect-ratio: 1 / 1;

        position: absolute;
        top: 0;
        left: 0;

        z-index: 10;
    }
}

.tip__grid
{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;

    border: 0;
    
    gap: 1rem;
    place-items: center;
    
    font-weight: bold;

    height: fit-content;

    place-items: stretch;

    legend
    {
        margin-bottom: 0.5rem;
        
        color: var(--grey-600);
    }

    .tip__input
    {
        padding: .5rem;
        /* width: 9.2rem;
        height: 3rem; */

        font-size: 1.5rem;
        
        background-color: var(--green-900);
        color: var(--white);

        border-radius: 5px;

        text-align: center;
        
        border: 0;
        
        transition: background-color 0.3s;
    }

    .tip__input:hover
    {
        background-color: var(--green-400);
    }


    input[type="radio"]:checked + label.tip__input
    {
        background-color: var(--green-400);
        color: var(--green-900);
    }

    .tip__input[type="text"]
    {
        width: 100%;

        background-color: var(--grey-50);
        color: var(--green-900);

        font-weight: bold;
        text-transform: capitalize;
    }

    .radio__input
    {
        display: none;
    }
}

.result
{
    padding: 1rem;

    background-color: var(--green-900);

    color: white;
    font-weight: bold;
    font-size: 1.2rem;

    border-radius: 18px;

    display: grid;
    grid-template-rows: auto;
    grid-template-columns: repeat(2, 1fr);

    gap: 1rem;

    .result__tip,
    .result__total
    {
        display: flex;
        flex-direction: column;

        &::after
        {
            content: "/person";
            font-size: 0.9rem;
            color: var(--grey-400);
        }
    }

    .result__price
    {
        text-align: end;
        color: var(--green-400);
    }

    .result__button
    {
        grid-column: 1/3;
        padding: 1rem 0;

        font-size: 1.5rem;
        text-transform: uppercase;
        font-weight: bold;
        background-color: var(--green-400);
        color: var(--green-900);

        border-radius: 8px;
        border: 0;
    }
}

@media (min-width: 48rem) 
{

    .form
    {
        font-size: 1.5rem;

        height: 35rem;
        flex-direction: row;
    }

    .desktop__left__side
    {
        width: 50%;
        justify-content: space-around;
    }

    .tip__grid
    {
        grid-template-columns: repeat(3, 1fr);
    }    

    .result
    {
        font-size: 1.8rem;
        width: 50%;

        padding: 3rem;

        .result__tip,
        .result__total
        {
            &::after
            {
                font-size: 1.3rem;
            }
        }

        .result__button
        {
            width: 100%;
            height: 4rem;
            align-self: end;
        }
    }
}