* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}

body {
    background-color: pink;
}

.container {
    height: 100vh;
    width: 100vw;
    display: grid;
    place-items: center;
}

.calculator {
    padding: 20px;
    background-color: lightcoral;
    border-radius: 10px;
    box-shadow: 0 0 30px white;
    width: 90%;
    max-width: 400px;
}

#display {
    width: 100%;  /* Make the display take full available width */
    background-color: antiquewhite;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-size: 32px;
    text-align: right; /* Align text to the right */
    white-space: normal; /* Allow wrapping when the text reaches the container's edge */
    word-wrap: break-word; /* Allow long words to break and wrap to the next line */
    overflow-wrap: break-word; /* Wrap long words when necessary */
    line-height: 1.2;
    height: 150px; /* Allow the height to adjust to the content */
    max-height: 200px; /* Set a maximum height to prevent too much growth */
    word-break: break-word; /* Forces the text to break and wrap onto the next line */
    box-sizing: border-box; /* Include padding in the width/height calculation */
    overflow: hidden; /* ensures that text that overflows stays hidden */
    display: flex;
    flex-direction: column-reverse; /* Starts text at the bottom and moves in up as more text is added */
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
    grid-auto-rows: 60px;
}

button {
    background-color: antiquewhite;
    border: 0;
    font-size: 20px;
    cursor: pointer;
    border-radius: 5px;
}

button#equal {
    height: 130px;
    background-color: seagreen;
    grid-row: span 2;
}

button#clear,
.calculator button.btn-operator {
    background-color: seagreen;
}

.calculator button.btn-operator {
    background-color: darkseagreen;
}

.image-button{
    width: 75px;
    height: 50px;
    margin-left: 20px;
    margin-top: 20px;
    background-image: url('assets/namroud-gorguis-FZWivbri0Xk-unsplash.jpg');
    background-size: cover;
    background-position: center;
    border: none;
    cursor: pointer;
}

.image-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-button:hover {
    opacity: 0.8;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .calculator {
        width: 95%;
    }

    button {
        font-size: 18px;
        height: 50px;
    }

    button#equal {
        height: 100px;
    }

    #display {
        font-size: 50px;
    }
}

@media (max-width: 400px) {
    .calculator {
        width: 95%;
    }

    button {
        font-size: 16px;
        height: 45px;
    }

    button#equal {
        height: 90px;
    }

    #display {
        font-size: 24px;
    }
}
