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

:root {
    --primary-orange: #FF6B35;
    --dark-orange: #E55527;
    --accent-orange: #FF8C61;
    --dark-bg: #0D0D0D;
    --card-bg: rgba(20, 20, 20, 0.8);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --shadow: rgba(255, 107, 53, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0D0D0D 0%, #1A1A1A 50%, #0D0D0D 100%);
    min-height: 100vh;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 30px;
    max-width: 1200px;
    width: 100%;
}

/* Calculator Wrapper */
.calculator-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.calculator {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 40px var(--shadow);
    width: 100%;
    max-width: 420px;
}

.calculator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.calculator-header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-orange), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.install-btn {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.install-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* Display */
.display-wrapper {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.expression {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    min-height: 24px;
    word-wrap: break-word;
}

.display {
    font-size: 42px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    word-wrap: break-word;
    line-height: 1.2;
}

/* Buttons Grid */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 500;
    padding: 22px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    font-family: 'Inter', sans-serif;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

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

.btn-number {
    font-weight: 600;
}

.btn-operator {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
    color: var(--accent-orange);
    font-weight: 600;
}

.btn-operator:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.3), rgba(255, 107, 53, 0.2));
}

.btn-function {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.btn-equals {
    background: linear-gradient(135deg, var(--primary-orange), var(--dark-orange));
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 15px var(--shadow);
}

.btn-equals:hover {
    background: linear-gradient(135deg, var(--dark-orange), var(--primary-orange));
    box-shadow: 0 6px 20px var(--shadow);
}

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

/* Save Button */
.save-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-orange), var(--dark-orange));
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 600;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--shadow);
}

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

/* History Sidebar */
.history-wrapper {
    display: flex;
}

.history {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.history h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.history-expression {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.history-result {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-orange);
}

.empty-message {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* Scrollbar Styling */
.history::-webkit-scrollbar {
    width: 8px;
}

.history::-webkit-scrollbar-track {
    background: transparent;
}

.history::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 4px;
}

.history::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.5);
}

/* Responsive Design */
@media (max-width: 968px) {
    .container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .history {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .calculator {
        padding: 20px;
    }
    
    .display {
        font-size: 32px;
    }
    
    .btn {
        padding: 18px;
        font-size: 20px;
    }
    
    .buttons {
        gap: 8px;
    }
}
