Calculator Css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.calculator {
background: #2d3748;
border-radius: 20px;
padding: 25px;
box-shadow:
0 20px 40px rgba(0, 0, 0, 0.3),
0 0 0 1px rgba(255, 255, 255, 0.1);
position: relative;
overflow: hidden;
animation: slideIn 0.6s ease-out;
}
.calculator::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 2px;
background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
animation: shimmer 2s ease-in-out infinite;
}
.display-container {
background: #1a202c;
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
position: relative;
box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.previous-operation {
color: #a0aec0;
font-size: 14px;
text-align: right;
min-height: 20px;
margin-bottom: 5px;
opacity: 0.7;
transition: all 0.3s ease;
}
.display {
background: transparent;
border: none;
color: #ffffff;
font-size: 2.5rem;
text-align: right;
width: 100%;
outline: none;
font-weight: 300;
letter-spacing: 1px;
min-height: 60px;
font-family: 'Courier New', monospace;
}
.display::placeholder {
color: #4a5568;
}
.buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 15px;
}
.btn {
border: none;
border-radius: 12px;
font-size: 1.2rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
position: relative;
overflow: hidden;
height: 60px;
font-family: inherit;
user-select: none;
background: linear-gradient(145deg, #4a5568, #2d3748);
color: #ffffff;
box-shadow:
0 4px 8px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn:active {
transform: scale(0.95);
box-shadow:
0 2px 4px rgba(0, 0, 0, 0.3),
inset 0 2px 8px rgba(0, 0, 0, 0.3);
}
.btn:hover {
transform: translateY(-2px);
box-shadow:
0 6px 12px rgba(0, 0, 0, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
transition: left 0.5s ease;
}
.btn:hover::before {
left: 100%;
}
/* Button Types */
.btn-number {
background: linear-gradient(145deg, #4a5568, #2d3748);
color: #ffffff;
}
.btn-number:hover {
background: linear-gradient(145deg, #5a6578, #3d4758);
}
.btn-operator {
background: linear-gradient(145deg, #ed8936, #dd6b20);
color: #ffffff;
font-weight: 600;
}
.btn-operator:hover {
background: linear-gradient(145deg, #fd9946, #ed7930);
}
.btn-operator.active {
background: linear-gradient(145deg, #ffffff, #f7fafc);
color: #ed8936;
box-shadow:
0 2px 4px rgba(0, 0, 0, 0.3),
inset 0 2px 8px rgba(237, 137, 54, 0.3);
}
.btn-function {
background: linear-gradient(145deg, #718096, #4a5568);
color: #ffffff;
}
.btn-function:hover {
background: linear-gradient(145deg, #8196a6, #5a6578);
}
.btn-equals {
background: linear-gradient(145deg, #38b2ac, #319795);
color: #ffffff;
font-weight: 600;
}
.btn-equals:hover {
background: linear-gradient(145deg, #48c2bc, #3997a5);
}
.btn-clear {
background: linear-gradient(145deg, #e53e3e, #c53030);
color: #ffffff;
font-weight: 600;
}
.btn-clear:hover {
background: linear-gradient(145deg, #f54e4e, #d53040);
}
/* Special button layouts */
.btn-zero {
grid-column: span 2;
}
/* Ripple effect */
.ripple {
position: absolute;
border-radius: 50%;
background: rgba(255, 255, 255, 0.3);
transform: scale(0);
animation: ripple-animation 0.6s ease-out;
pointer-events: none;
}
/* Animations */
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(30px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
@keyframes shimmer {
0%, 100% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
}
@keyframes ripple-animation {
to {
transform: scale(4);
opacity: 0;
}
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-5px); }
75% { transform: translateX(5px); }
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.error {
animation: shake 0.5s ease-in-out;
}
.calculate {
animation: pulse 0.3s ease-in-out;
}
/* Responsive design */
@media (max-width: 480px) {
.calculator {
width: 100%;
max-width: 350px;
padding: 20px;
}
.display {
font-size: 2rem;
}
.btn {
height: 50px;
font-size: 1rem;
}
.buttons {
gap: 10px;
}
}
/* Dark theme enhancements */
.calculator {
backdrop-filter: blur(10px);
}
.display-glow {
box-shadow:
inset 0 2px 10px rgba(0, 0, 0, 0.5),
0 0 20px rgba(102, 126, 234, 0.3);
}
/* History feature */
.history {
position: absolute;
top: 10px;
right: 15px;
background: rgba(255, 255, 255, 0.1);
border: none;
color: #a0aec0;
border-radius: 50%;
width: 30px;
height: 30px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
transition: all 0.3s ease;
}
.history:hover {
background: rgba(255, 255, 255, 0.2);
color: #ffffff;
}
Public Last updated: 2026-08-25 08:29:06 AM