/* 高级计算器样式 */
* {
    box-sizing: border-box;
}

.calculator-wrapper {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.calculator-main {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    border: 1px solid #e4e7ed;
}

.calculator-header {
    background: #f5f7fa;
    padding: 12px 15px;
    border-bottom: 1px solid #e4e7ed;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.mode-tabs {
    display: flex;
    gap: 8px;
}

.mode-tab {
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    color: #606266;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.mode-tab:hover {
    border-color: #409EFF;
    color: #409EFF;
}

.mode-tab.active {
    background: #409EFF;
    color: white;
    border-color: #409EFF;
}

.calculator-body {
    padding: 12px;
}

.display-container {
    background: #fafafa;
    border: 1px solid #e4e7ed;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    min-height: 75px;
}

.display-expression {
    font-size: 13px;
    color: #909399;
    min-height: 18px;
    word-wrap: break-word;
    margin-bottom: 6px;
}

.display-result {
    font-size: 24px;
    font-weight: 500;
    color: #303133;
    text-align: right;
    word-wrap: break-word;
}

.keypad {
    display: grid;
    gap: 6px;
}

.keypad.basic {
    grid-template-columns: repeat(4, 1fr);
}

.keypad.scientific {
    grid-template-columns: repeat(5, 1fr);
}

.keypad.programmer {
    grid-template-columns: repeat(4, 1fr);
}

.calc-btn {
    padding: 12px;
    font-size: 15px;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 400;
    background: #fff;
    color: #303133;
}

.calc-btn:hover:not(:disabled) {
    background: #f5f7fa;
    border-color: #409EFF;
}

.calc-btn:active:not(:disabled) {
    background: #e4e7ed;
}

.calc-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.calc-btn.number {
    background: #fff;
}

.calc-btn.operator {
    background: #ecf5ff;
    color: #409EFF;
    border-color: #b3d8ff;
}

.calc-btn.operator:hover:not(:disabled) {
    background: #d9ecff;
    border-color: #409EFF;
}

.calc-btn.function {
    background: #fdf6ec;
    color: #e6a23c;
    border-color: #f5dab1;
    font-size: 13px;
}

.calc-btn.function:hover:not(:disabled) {
    background: #faecd8;
    border-color: #e6a23c;
}

.calc-btn.clear {
    background: #fef0f0;
    color: #f56c6c;
    border-color: #fbc4c4;
}

.calc-btn.clear:hover:not(:disabled) {
    background: #fde2e2;
    border-color: #f56c6c;
}

.calc-btn.equals {
    background: #f0f9ff;
    color: #409EFF;
    border-color: #b3d8ff;
    font-weight: 500;
}

.calc-btn.equals:hover:not(:disabled) {
    background: #409EFF;
    color: white;
    border-color: #409EFF;
}

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

.history-panel {
    width: 280px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e4e7ed;
    display: flex;
    flex-direction: column;
    max-height: 600px;
}

.history-header {
    padding: 15px;
    border-bottom: 1px solid #e4e7ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.history-header h3 {
    margin: 0;
    font-size: 16px;
    color: #303133;
    font-weight: 500;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #fafafa;
    border: 1px solid #e4e7ed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.history-item:hover {
    background: #f5f7fa;
    border-color: #409EFF;
}

.history-expression {
    font-size: 13px;
    color: #606266;
    margin-bottom: 4px;
}

.history-result {
    font-size: 16px;
    font-weight: 500;
    color: #303133;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #909399;
}

.base-selector {
    display: flex;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 4px;
}

.base-btn {
    padding: 5px 10px;
    border: 1px solid #dcdfe6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
    min-width: 45px;
}

.base-btn.active {
    background: #409EFF;
    color: white;
    border-color: #409EFF;
}

.base-btn:hover:not(.active) {
    border-color: #409EFF;
    background: #ecf5ff;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .calculator-wrapper {
        flex-direction: column;
    }
    
    .history-panel {
        width: 100%;
        max-height: 350px;
    }
    
    .keypad {
        gap: 6px;
    }
    
    .calc-btn {
        padding: 14px;
        font-size: 15px;
    }
    
    .display-result {
        font-size: 24px;
    }
    
    .calculator-body {
        padding: 12px;
    }
}

/* 滚动条样式 */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f5f7fa;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #dcdfe6;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #c0c4cc;
}
