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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.calculator-container {
    width: 100%;
    max-width: 800px;
}

.calculator {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.display-section {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 20px;
    color: white;
}

.history-display {
    font-size: 14px;
    color: #bdc3c7;
    margin-bottom: 5px;
    min-height: 20px;
}

.display {
    width: 100%;
    font-size: 2.5em;
    background: transparent;
    border: none;
    color: white;
    text-align: right;
    outline: none;
    font-family: 'Courier New', monospace;
}

.result-display {
    font-size: 1.2em;
    color: #3498db;
    margin-top: 5px;
    min-height: 25px;
}

.mode-selector {
    display: flex;
    background: #ecf0f1;
    border-bottom: 2px solid #bdc3c7;
}

.mode-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: #d5dbdb;
}

.mode-btn.active {
    background: #3498db;
    color: white;
}

.calculator-body {
    padding: 20px;
}

.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

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

.button-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.btn {
    padding: 20px;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn.number {
    background: #f8f9fa;
    color: #2c3e50;
}

.btn.operator {
    background: #3498db;
    color: white;
}

.btn.function {
    background: #e74c3c;
    color: white;
    font-size: 14px;
}

.btn.equals {
    background: #27ae60;
    color: white;
    grid-column: span 2;
}

.btn.clear {
    background: #f39c12;
    color: white;
}

.scientific-buttons {
    margin-bottom: 20px;
}

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

/* Graph Mode Styles */
.graph-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.graph-controls input {
    flex: 1;
    padding: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    font-size: 16px;
}

.graph-settings {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.graph-settings label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: #2c3e50;
}

.graph-settings input {
    padding: 5px;
    border: 1px solid #bdc3c7;
    border-radius: 3px;
    margin-top: 5px;
}

.graph-container {
    height: 400px;
    border: 2px solid #bdc3c7;
    border-radius: 10px;
    background: white;
}

/* Equation Mode Styles */
.equation-controls {
    margin-bottom: 20px;
}

.equation-controls select {
    width: 100%;
    padding: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    font-size: 16px;
}

.equation-inputs {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.equation-inputs input {
    padding: 10px;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    font-size: 16px;
}

.equation-solution {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

/* Responsive Design */
@media (max-width: 600px) {
    .calculator {
        margin: 10px;
    }
    
    .display {
        font-size: 2em;
    }
    
    .btn {
        padding: 15px;
        font-size: 16px;
    }
    
    .graph-settings {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .button-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mode-panel.active {
    animation: fadeIn 0.3s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .calculator {
        background: rgba(44, 62, 80, 0.95);
        color: white;
    }
    
    .btn.number {
        background: #34495e;
        color: white;
    }
    
    .mode-selector {
        background: #34495e;
    }
    
    .mode-btn:hover {
        background: #2c3e50;
    }
}