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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #8D6E63 0%, #6D4C41 50%, #5D4037 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin: 0;
    box-sizing: border-box;
}

.calculator-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 380px;
    max-height: 100vh;
    height: 100%;
}

.calculator {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.1),
        0 0 0 1px rgba(255,255,255,0.1);
    width: 100%;
    max-height: 100vh;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-header {
    text-align: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.calculator-header h1 {
    font-size: 1.4em;
    font-weight: 600;
    color: #2d3748;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
}

.display-container {
    margin-bottom: 15px;
    flex-shrink: 0;
}

.display {
    width: 100%;
    height: 60px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    box-shadow: inset 0 4px 15px rgba(0,0,0,0.1);
    font-size: 1.6em;
    font-weight: 600;
    text-align: right;
    padding: 0 15px;
    color: #2d3748;
    outline: none;
    cursor: default;
}

.buttons-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 8px;
    height: 300px;
    flex: 1;
}

.btn {
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 45px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: scale(0.95);
}

.btn-number {
    background: linear-gradient(135deg, #ffffff, #f7fafc);
    color: #2d3748;
    border: 1px solid #e2e8f0;
}

.btn-number:hover {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn-operator {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

.btn-operator:hover {
    background: linear-gradient(135deg, #3182ce, #2c5282);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
}

.btn-equals {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    grid-row: span 2;
}

.btn-equals:hover {
    background: linear-gradient(135deg, #38a169, #2f855a);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

.btn-clear {
    background: linear-gradient(135deg, #fc8181, #f56565);
    color: white;
}

.btn-clear:hover {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.4);
}

.btn-backspace {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
}

.btn-backspace:hover {
    background: linear-gradient(135deg, #dd6b20, #c05621);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(237, 137, 54, 0.4);
}

.btn-wide {
    grid-column: span 2;
}

.btn-tall {
    grid-row: span 2;
}

.btn-zero {
    grid-column: span 2;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .calculator {
        padding: 15px;
        max-height: 100vh;
        border-radius: 16px;
    }
    
    .calculator-header {
        margin-bottom: 12px;
    }
    
    .calculator-header h1 {
        font-size: 1.3em;
    }
    
    .display-container {
        margin-bottom: 12px;
    }
    
    .display {
        height: 50px;
        font-size: 1.4em;
        padding: 0 12px;
        border-radius: 12px;
    }
    
    .buttons-container {
        gap: 6px;
        height: 280px;
    }
    
    .btn {
        font-size: 1em;
        border-radius: 10px;
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 3px;
    }
    
    .calculator-container {
        max-height: 100vh;
    }
    
    .calculator {
        padding: 12px;
        max-height: 100vh;
        border-radius: 14px;
    }
    
    .calculator-header {
        margin-bottom: 10px;
    }
    
    .calculator-header h1 {
        font-size: 1.2em;
    }
    
    .display-container {
        margin-bottom: 10px;
    }
    
    .display {
        height: 45px;
        font-size: 1.3em;
        padding: 0 10px;
        border-radius: 10px;
    }
    
    .buttons-container {
        gap: 5px;
        height: 260px;
    }
    
    .btn {
        font-size: 0.95em;
        border-radius: 8px;
        min-height: 38px;
    }
}

@media (max-width: 320px) {
    body {
        padding: 5px;
    }
    
    .calculator {
        padding: 12px;
        max-height: 97vh;
    }
    
    .calculator-header {
        margin-bottom: 12px;
    }
    
    .calculator-header h1 {
        font-size: 1.2em;
    }
    
    .display-container {
        margin-bottom: 12px;
    }
    
    .display {
        height: 45px;
        font-size: 1.2em;
        padding: 0 10px;
    }
    
    .buttons-container {
        gap: 4px;
        height: 250px;
    }
    
    .btn {
        font-size: 1em;
    }
}

