/* ===================================================================
   利润计算器增强功能样式
   包含：历史记录、目标倒推、智能建议
   作者：Claude
   日期：2025-10-17
   =================================================================== */

/* ===== 历史记录样式 ===== */
.history-card {
    max-height: 500px;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.history-search {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.history-search:focus {
    border-color: #667eea;
    outline: none;
}

.history-clear-btn {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s;
}

.history-clear-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.history-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-details {
    font-size: 13px;
    color: #6c757d;
}

.history-profit {
    font-weight: 700;
    margin: 0 15px;
    font-size: 16px;
    white-space: nowrap;
}

.history-profit.positive {
    color: #28a745;
}

.history-profit.negative {
    color: #dc3545;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.history-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.history-load-btn {
    background: #667eea;
    color: white;
}

.history-load-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

.history-delete-btn {
    background: #dc3545;
    color: white;
}

.history-delete-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 15px;
}

/* ===== 目标倒推样式 ===== */
.mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s;
}

.mode-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.reverse-result {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    border-left: 4px solid #28a745;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.1);
}

.reverse-result h4 {
    color: #28a745;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 700;
}

.reverse-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #c3e6cb;
}

.reverse-item:last-child {
    border-bottom: none;
}

.reverse-label {
    font-weight: 500;
    color: #495057;
    font-size: 15px;
}

.reverse-value {
    font-weight: 700;
    color: #28a745;
    font-size: 18px;
}

/* ===== 智能建议样式 ===== */
.suggestions-box {
    background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
    border-left: 4px solid #ffc107;
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.suggestions-title {
    font-size: 18px;
    font-weight: 700;
    color: #856404;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-item {
    padding: 12px 0;
    border-bottom: 1px solid #ffe8a1;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-label {
    font-weight: 600;
    color: #856404;
    margin-bottom: 5px;
    font-size: 15px;
}

.suggestion-text {
    color: #664d03;
    font-size: 14px;
    line-height: 1.6;
}

.profit-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.profit-badge.excellent {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.profit-badge.good {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.profit-badge.normal {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.profit-badge.poor {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== 响应式优化 ===== */
@media (max-width: 768px) {
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .history-profit {
        margin: 0;
    }

    .history-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .mode-toggle {
        flex-direction: column;
        gap: 8px;
    }

    .reverse-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .reverse-value {
        font-size: 16px;
    }

    .history-header {
        flex-direction: column;
        align-items: stretch;
    }

    .history-clear-btn {
        width: 100%;
    }
}

/* ===== 滚动条美化 ===== */
.history-card::-webkit-scrollbar {
    width: 8px;
}

.history-card::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.history-card::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.history-card::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

.history-item,
.reverse-result,
.suggestions-box {
    animation: slideIn 0.3s ease-out;
}
