/* 科学计算器专用样式 - 与js-minifier保持一致设计语言 */
.calculator-tool {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 计算器卡片样式 */
.calculator-card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
    overflow: hidden;
}

.calculator-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.calculator-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* 显示屏样式 */
.calculator-display {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1.5rem;
    text-align: right;
    border-bottom: 2px solid #dee2e6;
}

.display-expression {
    font-size: 0.875rem;
    color: #bdc3c7;
    min-height: 1.2rem;
    margin-bottom: 0.25rem;
}

.display-main {
    font-size: 2rem;
    font-weight: 300;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    min-height: 2.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 按键网格样式 */
.calculator-keypad {
    padding: 1rem;
    background: #ffffff;
}

.keypad-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.keypad-row:last-child {
    margin-bottom: 0;
}

/* 按钮样式 */
.calc-btn {
    flex: 1;
    padding: 1rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    user-select: none;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

.calc-btn:active {
    transform: translateY(0);
    box-shadow: inset 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

/* 按钮类型样式 */
.calc-btn.btn-number {
    background: #f8f9fa;
    color: #495057;
}

.calc-btn.btn-number:hover {
    background: #e9ecef;
    color: #495057;
}

.calc-btn.btn-operator {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.calc-btn.btn-operator:hover {
    background: #bbdefb;
    color: #1565c0;
}

.calc-btn.btn-equals {
    background: #4caf50;
    color: white;
    border-color: #45a049;
    font-weight: 600;
}

.calc-btn.btn-equals:hover {
    background: #45a049;
    color: white;
}

.calc-btn.btn-clear {
    background: #ffebee;
    color: #c62828;
    border-color: #ffcdd2;
}

.calc-btn.btn-clear:hover {
    background: #ffcdd2;
    color: #b71c1c;
}

.calc-btn.btn-function {
    background: #fff3e0;
    color: #f57c00;
    border-color: #ffe0b2;
}

.calc-btn.btn-function:hover {
    background: #ffe0b2;
    color: #ef6c00;
}

.calc-btn.btn-memory {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #e1bee7;
}

.calc-btn.btn-memory:hover {
    background: #e1bee7;
    color: #6a1b9a;
}

/* 特殊按钮样式 */
.calc-btn.btn-zero {
    flex: 2;
}

/* 统计信息样式 */
.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #495057;
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.stat-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* 历史记录样式 */
.history-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 0.375rem;
    border-left: 4px solid #0d6efd;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.875rem;
}

.history-item:hover {
    background: #e9ecef;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

.history-expression {
    color: #495057;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.history-result {
    color: #0d6efd;
    font-weight: 600;
}

.history-time {
    color: #6c757d;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* 状态栏样式 */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #0d47a1;
}

/* 按钮组增强 */
.btn-group .btn {
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-group .btn:hover {
    transform: translateY(-1px);
}

.btn-group .btn-check:checked + .btn {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* 内存指示器 */
.badge {
    font-weight: 500;
}

/* 卡片增强 */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 991.98px) {
    .calculator-card {
        margin-bottom: 2rem;
    }

    .calc-btn {
        padding: 0.75rem 0.25rem;
        font-size: 0.875rem;
        min-height: 3rem;
    }

    .display-main {
        font-size: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .keypad-row {
        gap: 0.25rem;
        margin-bottom: 0.25rem;
    }

    .calc-btn {
        padding: 0.75rem 0.25rem;
        font-size: 0.875rem;
        min-height: 2.75rem;
    }

    .display-main {
        font-size: 1.25rem;
    }

    .calculator-display {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .keypad-row {
        gap: 0.125rem;
    }

    .calc-btn {
        font-size: 0.75rem;
        padding: 0.625rem 0.125rem;
        min-height: 2.5rem;
    }

    .display-main {
        font-size: 1.125rem;
    }

    .calculator-keypad {
        padding: 0.5rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .calc-btn {
        min-height: 3.75rem;
        font-size: 1.125rem;
    }

    .calc-btn:active {
        background: #007bff;
        color: white;
        transform: scale(0.95);
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .calc-btn {
        border-width: 2px;
    }

    .display-main {
        font-weight: 400;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .calc-btn,
    .card,
    .stat-item,
    .history-item {
        transition: none;
    }

    .calc-btn:hover,
    .card:hover,
    .stat-item:hover,
    .history-item:hover {
        transform: none;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .calculator-keypad {
        background: #2d3748;
    }

    .calc-btn {
        background: #4a5568;
        color: #e2e8f0;
        border-color: #718096;
    }

    .calc-btn.btn-number:hover {
        background: #718096;
        color: #e2e8f0;
    }

    .card {
        background: #2d3748;
        color: #e2e8f0;
    }

    .card-header {
        background: #4a5568;
        border-bottom-color: #718096;
    }

    .history-item {
        background: #4a5568;
        color: #e2e8f0;
    }

    .history-item:hover {
        background: #718096;
    }
}

/* 焦点状态 */
.calc-btn:focus,
.btn:focus {
    outline: 2px solid #80bdff;
    outline-offset: 2px;
}

/* 加载状态 */
.calculator-loading {
    opacity: 0.6;
    pointer-events: none;
}

.calculator-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}