/* 计算器容器 */
.calculator-container {
    display: flex;
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
    justify-content: center;
}

/* 左侧计算器面板 */
.calculator-panel {
    flex: 1;
    max-width: 400px;
}

.calculator {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 显示屏 */
.display {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    color: white;
    font-family: 'Courier New', monospace;
}

.display-expression {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    min-height: 1.2rem;
    word-break: break-all;
}

.display-result {
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    word-break: break-all;
}

/* 按钮网格 */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

/* 按钮基础样式 */
.btn {
    height: 60px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 数字按钮 */
.btn-number {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

.btn-number:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}

/* 运算符按钮 */
.btn-operator {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
}

.btn-operator:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

/* 等号按钮 */
.btn-equals {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-equals:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* 清除按钮 */
.btn-clear {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-clear:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* 撤销按钮 */
.btn-undo {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-undo:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* 0按钮占两列 */
.btn-zero {
    grid-column: span 2;
}

/* 右侧历史记录面板 */
.history-panel {
    flex: 1;
    max-width: 400px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-clear-history {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-history:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-1px);
}

.history-list {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 502px;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 1rem;
}

.history-empty {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 2rem;
}

.history-item {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.history-item:hover {
    background-color: #f1f5f9;
}

.history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-expression {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.25rem;
    font-family: 'Courier New', monospace;
}

.history-result {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    font-family: 'Courier New', monospace;
}

/* 功能介绍样式 */
.features-section {
    margin-top: 60px;
    padding: 40px 0;
    border-radius: 16px;
}

.features-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 40px;
    position: relative;
}

.features-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 2px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}

.feature-card {
    background: white;
    padding: 30px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #4f46e5;
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.feature-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}

.feature-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.usage-guide {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
}

.guide-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 24px;
    text-align: center;
}

.guide-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.guide-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.guide-text {
    flex: 1;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
}

.guide-text strong {
    color: #1e293b;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .calculator-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .calculator-panel,
    .history-panel {
        max-width: none;
    }
    
    .calculator {
        padding: 1rem;
    }
    
    .display {
        padding: 1rem;
        min-height: 60px;
    }
    
    .display-result {
        font-size: 1.5rem;
    }
    
    .btn {
        height: 50px;
        font-size: 1rem;
    }
    
    .buttons {
        gap: 0.5rem;
    }
    
    .history-list {
        max-height: 300px;
    }
    
    /* 功能介绍响应式 */
    .features-section {
        margin-top: 40px;
        padding: 30px 20px;
    }
    
    .features-title {
        font-size: 24px;
        margin-bottom: 30px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 40px;
    }
    
    .feature-card {
        padding: 24px 20px;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 16px;
    }
    
    .usage-guide {
        padding: 24px 20px;
    }
    
    .guide-title {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .guide-item {
        gap: 12px;
    }
    
    .guide-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
}

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

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

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

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

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-item {
    animation: fadeIn 0.3s ease;
}

/* 错误状态 */
.display.error .display-result {
    color: #ef4444;
}

.display.error .display-expression {
    color: #fca5a5;
}