/* CSS Reset and Basic Setup */
*, *::before, *::after {
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a2a6c;
    overflow: hidden; /* Hide the parts of the shapes that go off-screen */
}

/* Animated background shapes */
.background-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.background-shapes::before, .background-shapes::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: float 15s infinite ease-in-out;
}

.background-shapes::before {
    width: 40vmax;
    height: 40vmax;
    background: linear-gradient(135deg, #b21f1f, #fdbb2d);
    top: -10%;
    left: -10%;
}

.background-shapes::after {
    width: 30vmax;
    height: 30vmax;
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    bottom: -15%;
    right: -15%;
    animation-delay: 2s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-30px) translateX(20px);
    }
}


/* Main Calculator Grid Layout */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    
    /* Glassmorphism Effect */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Span rules for specific buttons */
.span-two-columns { grid-column: span 2; }
.span-two-rows { grid-row: span 2; }

/* Styling for all buttons */
.calculator-grid > button {
    cursor: pointer;
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: 500;
    border: none;
    outline: none;
    border-radius: 15px;
    padding: 20px;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Interactive hover and active states */
.calculator-grid > button:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.calculator-grid > button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Different styling for operator buttons */
button[data-operator], button[data-equals] {
    background-color: rgba(255, 159, 67, 0.5);
}

/* Different styling for utility buttons */
button[data-all-clear], button[data-delete] {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Display Area Styling */
.display {
    grid-column: 1 / -1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-around;
    word-wrap: break-word;
    word-break: break-all;
    min-height: 120px;
}

.previous-operand {
    color: rgba(255, 255, 255, .75);
    font-size: clamp(1rem, 4vw, 1.5rem);
}

.current-operand {
    color: white;
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 700;
}
