@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2c3e50;
    margin: 0;
}

.calculator {
    width: 630px;
    background-color: #1c2833;
    border-radius: 10px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.25);
    padding: 20px;
    color: #ecf0f1;
    position: relative;
}


/* Calculator display styling */
.calculator-display {
    margin-bottom: 10px;
    width: 100%;
    max-width: 600px; /* Set a max-width to limit the size */
    background-color: #34495e;
    border: none;
    border-radius: 5px;
    font-size: 2em;
    color: #ecf0f1;
    padding: 15px;
    text-align: right;
    box-shadow: inset 0px 4px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.3s ease;
}

.calculator-display:focus {
    outline: none;
    background-color: #2c3e50;
}

.calculator-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.btn {
    margin: 1px;
    width: 20%;
    padding: 15px;
    border: none;
    border-radius: 5px;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 1.2em;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s ease;
}

.btn:active {
    transform: scale(0.95);
    box-shadow: none;
}

.btn:hover {
    background-color: #2c3e50;
}

.btn.operator {
    background-color: #e74c3c;
    color: #ffffff;
}

.btn.operator:hover {
    background-color: #c0392b;
}

.btn.clear {
    background-color: #e67e22;
    color: #ffffff;
}

.btn.clear:hover {
    background-color: #d35400;
}

.btn.equal {
    background-color: #27ae60;
    color: #ffffff;
    font-weight: 700;
}

.btn.equal:hover {
    background-color: #229954;
}

.btn.function {
    background-color: #2980b9;
    color: #ffffff;
}

.btn.function:hover {
    background-color: #21618c;
}

.btn.toggle {
    background-color: #8e44ad;
    color: #ffffff;
    width: 100%;
}

.btn.toggle:hover {
    background-color: #71368a;
}

.sign-change {
    background-color: #16a085;
    color: #ffffff;
}

.sign-change:hover {
    background-color: #138d75;
}

/* Calculator button animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) rotate(45deg);
    transition: width 0.3s, height 0.3s, top 0.3s, left 0.3s;
    z-index: 0;
}

.btn:active::after {
    width: 0;
    height: 0;
    top: 50%;
    left: 50%;
}

/* Extra animation for hovering */
.btn:hover {
    background-position: center;
    transition: background 0.3s;
}

.btn:hover::before {
    animation: ripple 0.6s linear;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Media query for responsive design */
@media (max-width: 400px) {
    .calculator {
        width: 90%;
        padding: 15px;
    }

    .calculator-display {
        font-size: 1.5em;
    }

    .btn {
        font-size: 1em;
        padding: 10px;
    }
}
