:root {
    --bg-color: #0f172a;
    --calc-bg: #1e293b;
    --text-color: #ffffff;
    --btn-bg: #334155;
    --display-bg: #0f172a;
}

.light-theme {
    --bg-color: #f1f5f9;
    --calc-bg: #ffffff;
    --text-color: #1e293b;
    --btn-bg: #e2e8f0;
    --display-bg: #f8fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
}

.calculator {
    background-color: var(--calc-bg);
    padding: 25px;
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    width: 350px;
}

/* Toggle Switch Styling */
.toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #475569;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: #10b981; }
input:checked + .slider:before { transform: translateX(24px); }

/* Display & Buttons */
.display-container {
    background: var(--display-bg);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-align: right;
}

#display {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 2.5rem;
    text-align: right;
}

.previous-display {
    color: #64748b;
    font-size: 1rem;
    min-height: 20px;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

button {
    height: 60px;
    border-radius: 15px;
    border: none;
    background: var(--btn-bg);
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

.operator { background: #f59e0b !important; color: white; }
.control { background: #ef4444 !important; color: white; }
.equal { background: #10b981 !important; color: white; }
.span-two { grid-column: span 2; }