.calculator-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.calculator {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #e8eaed;
    width: 100%;
    max-width: 520px;
}

.display {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: right;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #e8eaed;
    position: relative;
}

.history-icon {
    position: absolute;
    top: 15px;
    left: 20px;
    cursor: pointer;
    color: #5f6368;
    font-size: 20px;
}

.expression {
    color: #5f6368;
    font-size: 14px;
    margin-bottom: 5px;
    min-height: 18px;
}

.result {
    color: #202124;
    font-size: 32px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calculator-body {
    display: flex;
    gap: 12px;
}

.scientific-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.main-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    flex: 1;
}

.calculator-btn {
    background: #e8eaed;
    border: none;
    border-radius: 10px;
    height: 60px;
    width: 60px;
    font-size: 16px;
    font-weight: 500;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calculator-btn:hover {
    background: #dadce0;
    transform: scale(1.02);
}

.calculator-btn:active {
    transform: scale(0.98);
}

.calculator-btn.function {
    background: #e8eaed;
    color: #1a73e8;
    font-weight: 500;
    font-size: 14px;
}

.calculator-btn.function:hover {
    background: #dadce0;
}

.calculator-btn.operator {
    background: #e8eaed;
    color: #1a73e8;
    font-size: 20px;
}

.calculator-btn.operator:hover {
    background: #dadce0;
}

.calculator-btn.equals {
    background: #1a73e8;
    color: white;
    font-size: 20px;
}

.calculator-btn.equals:hover {
    background: #1557b0;
}

.calculator-btn.clear {
    color: #d93025;
}

.history-panel {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e8eaed;
    padding: 20px;
    width: 400px;
    max-height: 600px;
    display: none;
}

.history-panel.show {
    display: block;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e8eaed;
}

.history-title {
    font-size: 18px;
    font-weight: 500;
    color: #202124;
}

.clear-history {
    background: #f8f9fa;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    color: #5f6368;
    cursor: pointer;
    transition: background-color 0.2s;
}

.clear-history:hover {
    background: #e8eaed;
}

.history-list {
    max-height: 500px;
    overflow-y: auto;
}

.no-history {
    text-align: center;
    color: #9aa0a6;
    font-size: 14px;
    padding: 40px 20px;
}

.history-item {
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 6px;
    margin-bottom: 4px;
    padding: 12px;
}

.history-item:hover {
    background-color: #f8f9fa;
}

.history-expression {
    font-size: 14px;
    color: #5f6368;
    margin-bottom: 4px;
}

.history-result {
    font-size: 16px;
    color: #202124;
    font-weight: 500;
}

/* Ensure all buttons in scientific panel are same size */
.scientific-panel .calculator-btn {
    height: 60px;
    width: 60px;
    font-size: 14px;
}

/* Main panel specific styling for 4x5 grid */
.main-panel {
    grid-template-rows: repeat(5, 60px);
}

@media (max-width: 768px) {
    .calculator-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .calculator {
        max-width: 100%;
        padding: 15px;
    }

    .history-panel {
        width: 100%;
        max-width: 520px;
        padding: 15px;
    }

    .calculator-btn {
        height: 40px;
        width: 40px;
        font-size: 12px;
    }

    .scientific-panel .calculator-btn {
        height: 40px;
        width: 40px;
        font-size: 12px;
    }

    .main-panel {
        grid-template-rows: repeat(5, 40px);
    }

    .result {
        font-size: 24px;
    }

    .display {
        padding: 15px;
        min-height: 60px;
    }
}